ReactOS 0.4.16-dev-91-g764881a
primStream Class Reference

#include <primitiveStream.h>

Public Member Functions

 primStream (Int sizeLengths, Int sizeVertices)
 
 ~primStream ()
 
Int get_n_prims ()
 
Int get_type (Int i)
 
Int get_length (Int i)
 
Realget_vertices ()
 
void begin ()
 
void insert (Real u, Real v)
 
void insert (Real v[2])
 
void end (Int type)
 
Int num_triangles ()
 
void triangle (Real A[2], Real B[2], Real C[2])
 
void print ()
 
void draw ()
 

Private Attributes

Intlengths
 
Inttypes
 
Realvertices
 
Int index_lengths
 
Int size_lengths
 
Int index_vertices
 
Int size_vertices
 
Int counter
 

Detailed Description

Definition at line 44 of file primitiveStream.h.

Constructor & Destructor Documentation

◆ primStream()

primStream::primStream ( Int  sizeLengths,
Int  sizeVertices 
)

Definition at line 145 of file primitiveStream.cc.

146{
147 lengths = (Int*)malloc (sizeof(Int) * sizeLengths);
149 types = (Int*)malloc (sizeof(Int) * sizeLengths);
150 assert(types);
151
152 vertices = (Real*) malloc(sizeof(Real) * sizeVertices);
154
155 index_lengths = 0;
156 index_vertices = 0;
157 size_lengths = sizeLengths;
158 size_vertices = sizeVertices;
159
160 counter = 0;
161}
Real * vertices
#define malloc
Definition: debug_ros.c:4
int Int
Definition: definitions.h:37
float Real
Definition: definitions.h:36
#define assert(x)
Definition: debug.h:53
GLsizei GLenum GLenum GLuint GLenum GLsizei * lengths
Definition: glext.h:7753
Definition: cmds.c:130

◆ ~primStream()

primStream::~primStream ( )

Definition at line 163 of file primitiveStream.cc.

164{
165 free(lengths);
166 free(types);
167 free(vertices);
168}
#define free
Definition: debug_ros.c:5

Member Function Documentation

◆ begin()

◆ draw()

void primStream::draw ( )

Definition at line 170 of file primitiveStream.cc.

171{
172 Int i,j,k;
173 k=0;
174 for(i=0; i<index_lengths; i++)
175 {
176 switch(types[i]){
179 break;
182 break;
183 }
184
185 for(j=0; j<lengths[i]; j++){
187 k += 2;
188 }
189 glEnd();
190 }
191}
#define GL_TRIANGLE_FAN
Definition: gl.h:196
GLAPI void GLAPIENTRY glBegin(GLenum mode)
GLAPI void GLAPIENTRY glEnd(void)
#define GL_TRIANGLE_STRIP
Definition: gl.h:195
GLAPI void GLAPIENTRY glVertex2fv(const GLfloat *v)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
int k
Definition: mpi.c:3369
@ PRIMITIVE_STREAM_FAN
@ PRIMITIVE_STREAM_STRIP

◆ end()

void primStream::end ( Int  type)

Definition at line 93 of file primitiveStream.cc.

94{
95 Int i;
96 /*if there is no vertex in this primitive,
97 *nothing needs to be done
98 */
99 if(counter == 0) return ;
100
102 Int* temp = (Int*) malloc(sizeof(Int) * (2*size_lengths + 2));
103 assert(temp);
104 Int* tempTypes = (Int*) malloc(sizeof(Int) * (2*size_lengths + 2));
105 assert(tempTypes);
106
107 /*copy*/
108 for(i=0; i<index_lengths; i++){
109 temp[i] = lengths[i];
110 tempTypes[i] = types[i];
111 }
112
113 free(lengths);
114 free(types);
115 lengths = temp;
116 types = tempTypes;
118 }
122}
return
Definition: dirsup.c:529
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static calc_node_t temp
Definition: rpn_ieee.c:38

Referenced by gridBoundaryChain::leftEndFan(), reflexChain::outputFan(), gridWrap::outputFanWithPoint(), reflexChain::processNewVertex(), gridBoundaryChain::rightEndFan(), sampleLeftSingleTrimEdgeRegion(), sampleLeftSingleTrimEdgeRegionGen(), triangulateXYMono(), and triangulateXYMonoTB().

◆ get_length()

Int primStream::get_length ( Int  i)
inline

Definition at line 73 of file primitiveStream.h.

74 {
75 return lengths[i];
76 }

Referenced by Slicer::evalStream().

◆ get_n_prims()

Int primStream::get_n_prims ( )
inline

Definition at line 65 of file primitiveStream.h.

66 {
67 return index_lengths;
68 }

Referenced by Slicer::evalStream().

◆ get_type()

Int primStream::get_type ( Int  i)
inline

Definition at line 69 of file primitiveStream.h.

70 {
71 return types[i];
72 }

Referenced by Slicer::evalStream().

◆ get_vertices()

Real * primStream::get_vertices ( )
inline

Definition at line 77 of file primitiveStream.h.

77{return vertices;}

Referenced by Slicer::evalStream().

◆ insert() [1/2]

void primStream::insert ( Real  u,
Real  v 
)

Definition at line 67 of file primitiveStream.cc.

68{
69 /*if the space cannot hold u and v,
70 *we have to expand the array
71 */
73 Real* temp = (Real*) malloc (sizeof(Real) * (2*size_vertices + 2));
74 assert(temp);
75
76 /*copy*/
77 for(Int i=0; i<index_vertices; i++)
78 temp[i] = vertices[i];
79
81 vertices = temp;
83 }
84
87 counter++;
88}
const GLdouble * v
Definition: gl.h:2040
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240

Referenced by gridBoundaryChain::leftEndFan(), reflexChain::outputFan(), gridWrap::outputFanWithPoint(), reflexChain::processNewVertex(), gridBoundaryChain::rightEndFan(), sampleLeftSingleTrimEdgeRegion(), sampleLeftSingleTrimEdgeRegionGen(), triangulateXYMono(), and triangulateXYMonoTB().

◆ insert() [2/2]

void primStream::insert ( Real  v[2])
inline

Definition at line 84 of file primitiveStream.h.

84{insert(v[0], v[1]);}
static int insert
Definition: xmllint.c:138

Referenced by insert().

◆ num_triangles()

Int primStream::num_triangles ( )

Definition at line 46 of file primitiveStream.cc.

47{
48 Int i;
49 Int ret=0;
50 for(i=0; i<index_lengths; i++)
51 {
52 ret += lengths[i]-2;
53 }
54 return ret;
55}
int ret

Referenced by Slicer::slice_new().

◆ print()

void primStream::print ( )

Definition at line 124 of file primitiveStream.cc.

125{
126 Int i,j,k;
127 printf("index_lengths=%i,size_lengths=%i\n", index_lengths, size_lengths);
128 printf("index_vertices=%i,size_vertices=%i\n", index_vertices, size_vertices);
129 k=0;
130 for(i=0; i<index_lengths; i++)
131 {
133 printf("primitive-FAN:\n");
134 else
135 printf("primitive-STRIP:\n");
136 for(j=0; j<lengths[i]; j++)
137 {
138 printf("(%f,%f) ", vertices[k], vertices[k+1]);
139 k += 2;
140 }
141 printf("\n");
142 }
143}
#define printf
Definition: freeldr.h:97

◆ triangle()

void primStream::triangle ( Real  A[2],
Real  B[2],
Real  C[2] 
)
inline

Definition at line 89 of file primitiveStream.h.

90 {
91 begin();
92 insert(A);
93 insert(B);
94 insert(C);
96 }
Definition: ehthrow.cxx:93
Definition: ehthrow.cxx:54
Definition: terminate.cpp:24
GLuint GLuint end
Definition: gl.h:1545

Referenced by monoTriangulation2(), and monoTriangulationRecGenTBOpt().

Member Data Documentation

◆ counter

Int primStream::counter
private

Definition at line 59 of file primitiveStream.h.

Referenced by end().

◆ index_lengths

Int primStream::index_lengths
private

Definition at line 50 of file primitiveStream.h.

Referenced by draw(), end(), get_n_prims(), num_triangles(), primStream(), and print().

◆ index_vertices

Int primStream::index_vertices
private

Definition at line 52 of file primitiveStream.h.

Referenced by insert(), primStream(), and print().

◆ lengths

Int* primStream::lengths
private

Definition at line 45 of file primitiveStream.h.

◆ size_lengths

Int primStream::size_lengths
private

Definition at line 51 of file primitiveStream.h.

Referenced by end(), primStream(), and print().

◆ size_vertices

Int primStream::size_vertices
private

Definition at line 53 of file primitiveStream.h.

Referenced by insert(), primStream(), and print().

◆ types

Int* primStream::types
private

Definition at line 46 of file primitiveStream.h.

◆ vertices

Real* primStream::vertices
private

Definition at line 47 of file primitiveStream.h.

Referenced by draw(), get_vertices(), insert(), primStream(), print(), and ~primStream().


The documentation for this class was generated from the following files: