-
Notifications
You must be signed in to change notification settings - Fork 0
/
DisplayMesh.h
98 lines (78 loc) · 2.58 KB
/
DisplayMesh.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/* $NoKeywords: $ */
/*
//
// Copyright (c) 1993-2011 Robert McNeel & Associates. All rights reserved.
// Rhinoceros is a registered trademark of Robert McNeel & Assoicates.
//
// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
// MERCHANTABILITY ARE HEREBY DISCLAIMED.
//
// For complete openNURBS copyright information see <http://www.opennurbs.org>.
//
////////////////////////////////////////////////////////////////
*/
//
// This class builds OpenGL vertex buffer objects for an ON_Mesh and draws the mesh when requested
//
#include "ESRenderer.h"
typedef struct {
ON_3fPoint vertex;
ON_3fVector normal;
} VertexData;
typedef struct {
ON_3fPoint vertex;
ON_3fVector normal;
ON_4fPoint color;
} VNCData;
typedef struct {
ON_3fPoint vertex;
ON_4fPoint color;
} VCData;
@interface DisplayMesh : NSObject {
ON_Color pickColor;
BOOL selected;
ON_Material material;
int partitionIndex;
ON_BoundingBox boundingBox;
BOOL hasVertexNormals;
BOOL hasVertexColors;
BOOL initializationFailed;
unsigned int stride;
unsigned int vertexIndexCount;
unsigned int triangleCount;
BOOL isClosed;
// OpenGL vertex buffers
unsigned int vertexBuffer;
unsigned int normalBuffer;
unsigned int indexBuffer;
bool captureVBOData;
NSData* vertexBufferData;
NSData* normalBufferData;
NSData* vertexAndNormalBufferData;
NSData* indexBufferData;
}
@property (nonatomic, assign) bool captureVBOData;
@property (nonatomic, assign) unsigned int vertexBuffer;
@property (nonatomic, assign) unsigned int normalBuffer;
@property (nonatomic, assign) unsigned int indexBuffer;
@property (nonatomic, assign) ON_Material material;
@property (nonatomic, assign) BOOL isClosed;
@property (nonatomic, assign) BOOL hasVertexNormals;
@property (nonatomic, assign) BOOL hasVertexColors;
@property (nonatomic, assign) unsigned int Stride;
@property (nonatomic, assign) ON_Color pickColor;
@property (nonatomic, assign) BOOL selected;
- (id) initWithMesh: (const ON_Mesh*) mesh index: (int) index material: (const ON_Material&) material saveVBOData: (BOOL) saveVBOData;
- (void) restoreUsingMesh: (const ON_Mesh*) onMesh material: (const ON_Material&) onMaterial;
- (unsigned int) triangleCount;
- (BOOL) isOpaque;
- (BOOL) hasVertexNormals;
- (BOOL) hasVertexColors;
- (unsigned int) Stride;
// Encode / decode mesh VBOs using aCoder
- (void)encodeWithCoder: (NSCoder*) aCoder;
- (id)initWithCoder: (NSCoder *) decoder;
- (void) reloadVBOData;
- (void) deleteVBOData;
@end