ReactOS  0.4.11-dev-465-g0e6bc23
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 ( Int  sizeLengths,
Int  sizeVertices 
)

Definition at line 145 of file primitiveStream.cc.

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

Member Function Documentation

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 }
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint 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 GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum const GLdouble const GLfloat const GLdouble const GLfloat GLenum GLint GLint GLint GLint GLint GLint j
Definition: glfuncs.h:98
GLenum GLclampf GLint i
Definition: glfuncs.h:14
GLsizei GLenum GLenum GLuint GLenum GLsizei * lengths
Definition: glext.h:7753
#define GL_TRIANGLE_FAN
Definition: gl.h:196
Definition: cmds.c:130
GLAPI void GLAPIENTRY glVertex2fv(const GLfloat *v)
GLAPI void GLAPIENTRY glBegin(GLenum mode)
Real * vertices
GLAPI void GLAPIENTRY glEnd(void)
#define GL_TRIANGLE_STRIP
Definition: gl.h:195
int k
Definition: mpi.c:3369
int Int
Definition: definitions.h:37
void primStream::end ( Int  type)

Definition at line 93 of file primitiveStream.cc.

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

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;
117  size_lengths = 2*size_lengths + 2;
118  }
121  index_lengths++;
122 }
return
Definition: dirsup.c:529
#define free
Definition: debug_ros.c:5
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define assert(x)
Definition: debug.h:53
GLenum GLclampf GLint i
Definition: glfuncs.h:14
GLsizei GLenum GLenum GLuint GLenum GLsizei * lengths
Definition: glext.h:7753
Definition: cmds.c:130
static stack_node_t temp
Definition: rpn.c:18
#define malloc
Definition: debug_ros.c:4
int Int
Definition: definitions.h:37
Int primStream::get_length ( Int  i)
inline

Definition at line 73 of file primitiveStream.h.

Referenced by Slicer::evalStream().

74  {
75  return lengths[i];
76  }
GLenum GLclampf GLint i
Definition: glfuncs.h:14
GLsizei GLenum GLenum GLuint GLenum GLsizei * lengths
Definition: glext.h:7753
Int primStream::get_n_prims ( )
inline

Definition at line 65 of file primitiveStream.h.

Referenced by Slicer::evalStream().

66  {
67  return index_lengths;
68  }
Int primStream::get_type ( Int  i)
inline

Definition at line 69 of file primitiveStream.h.

Referenced by Slicer::evalStream().

70  {
71  return types[i];
72  }
GLenum GLclampf GLint i
Definition: glfuncs.h:14
Definition: cmds.c:130
Real* primStream::get_vertices ( )
inline

Definition at line 77 of file primitiveStream.h.

Referenced by Slicer::evalStream().

77 {return vertices;}
Real * vertices
void primStream::insert ( Real  u,
Real  v 
)

Definition at line 67 of file primitiveStream.cc.

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

68 {
69  /*if the space cannot hold u and v,
70  *we have to expand the array
71  */
72  if(index_vertices+1 >= size_vertices) {
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 
80  free(vertices);
81  vertices = temp;
83  }
84 
87  counter++;
88 }
#define free
Definition: debug_ros.c:5
#define assert(x)
Definition: debug.h:53
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint 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 GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum const GLdouble * u
Definition: glfuncs.h:88
GLenum GLclampf GLint i
Definition: glfuncs.h:14
static stack_node_t temp
Definition: rpn.c:18
Real * vertices
const GLdouble * v
Definition: gl.h:2040
float Real
Definition: definitions.h:36
#define malloc
Definition: debug_ros.c:4
int Int
Definition: definitions.h:37
void primStream::insert ( Real  v[2])
inline

Definition at line 84 of file primitiveStream.h.

Referenced by insert().

84 {insert(v[0], v[1]);}
void insert(Real u, Real v)
const GLdouble * v
Definition: gl.h:2040
Int primStream::num_triangles ( )

Definition at line 46 of file primitiveStream.cc.

Referenced by Slicer::slice_new().

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 }
GLenum GLclampf GLint i
Definition: glfuncs.h:14
GLsizei GLenum GLenum GLuint GLenum GLsizei * lengths
Definition: glext.h:7753
int ret
int Int
Definition: definitions.h:37
void primStream::print ( void  )

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  {
132  if(types[i] == PRIMITIVE_STREAM_FAN)
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 }
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint 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 GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum const GLdouble const GLfloat const GLdouble const GLfloat GLenum GLint GLint GLint GLint GLint GLint j
Definition: glfuncs.h:98
GLenum GLclampf GLint i
Definition: glfuncs.h:14
GLsizei GLenum GLenum GLuint GLenum GLsizei * lengths
Definition: glext.h:7753
Definition: cmds.c:130
Real * vertices
int k
Definition: mpi.c:3369
#define printf
Definition: config.h:203
int Int
Definition: definitions.h:37
void primStream::triangle ( Real  A[2],
Real  B[2],
Real  C[2] 
)
inline

Definition at line 89 of file primitiveStream.h.

Referenced by monoTriangulation2(), and monoTriangulationRecGenTBOpt().

90  {
91  begin();
92  insert(A);
93  insert(B);
94  insert(C);
96  }
#define B(row, col)
Definition: m_matrix.c:146
void insert(Real u, Real v)
Definition: ttei1.cpp:12
Definition: ttei6.cpp:27
void end(Int type)

Member Data Documentation

Int primStream::counter
private

Definition at line 59 of file primitiveStream.h.

Referenced by end().

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().

Int primStream::index_vertices
private

Definition at line 52 of file primitiveStream.h.

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

Int* primStream::lengths
private

Definition at line 45 of file primitiveStream.h.

Int primStream::size_lengths
private

Definition at line 51 of file primitiveStream.h.

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

Int primStream::size_vertices
private

Definition at line 53 of file primitiveStream.h.

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

Int* primStream::types
private

Definition at line 46 of file primitiveStream.h.

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: