#include <SoTessellated.h>
|
void | addTriangularFacet (double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3) |
|
void | addQuadrangularFacet (double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4) |
|
void | finalize () |
|
| SoTessellated () |
|
virtual void | generateAlternateRep () |
|
virtual void | clearAlternateRep () |
|
Definition at line 23 of file SoTessellated.h.
◆ SoTessellated()
SoTessellated::SoTessellated |
( |
| ) |
|
◆ ~SoTessellated()
SoTessellated::~SoTessellated |
( |
| ) |
|
|
protectedvirtual |
◆ addQuadrangularFacet()
void SoTessellated::addQuadrangularFacet |
( |
double |
x1, |
|
|
double |
y1, |
|
|
double |
z1, |
|
|
double |
x2, |
|
|
double |
y2, |
|
|
double |
z2, |
|
|
double |
x3, |
|
|
double |
y3, |
|
|
double |
z3, |
|
|
double |
x4, |
|
|
double |
y4, |
|
|
double |
z4 |
|
) |
| |
◆ addTriangularFacet()
void SoTessellated::addTriangularFacet |
( |
double |
x1, |
|
|
double |
y1, |
|
|
double |
z1, |
|
|
double |
x2, |
|
|
double |
y2, |
|
|
double |
z2, |
|
|
double |
x3, |
|
|
double |
y3, |
|
|
double |
z3 |
|
) |
| |
Definition at line 43 of file SoTessellated.cxx.
58 const double edge1X(
x2-
x1), edge1Y(
y2-
y1), edge1Z(z2-z1);
59 const double edge2X(x3-
x1), edge2Y(y3-
y1), edge2Z(z3-z1);
60 double nx(edge1Y*edge2Z-edge1Z*edge2Y);
61 double ny(edge1Z*edge2X-edge1X*edge2Z);
62 double nz(edge1X*edge2Y-edge1Y*edge2X);
63 double nl(nx*nx+ny*ny+nz*nz);
64 const double s(1.0/sqrt(nl));
◆ clearAlternateRep()
void SoTessellated::clearAlternateRep |
( |
| ) |
|
|
virtual |
◆ computeBBox()
void SoTessellated::computeBBox |
( |
SoAction * |
action, |
|
|
SbBox3f & |
box, |
|
|
SbVec3f & |
center |
|
) |
| |
|
protectedvirtual |
◆ finalize()
void SoTessellated::finalize |
( |
| ) |
|
◆ generateAlternateRep()
void SoTessellated::generateAlternateRep |
( |
| ) |
|
|
virtual |
Definition at line 196 of file SoTessellated.cxx.
203 SoSeparator *
sep =
new SoSeparator;
206 SoVertexProperty* vertices =
new SoVertexProperty();
209 SoIndexedFaceSet* faceset =
new SoIndexedFaceSet;
212 faceset->coordIndex.set1Value(j++,
i);
213 if((
i>1) && ((
i-2)%3==0)) {
214 faceset->coordIndex.set1Value(j++,SO_END_FACE_INDEX);
218 faceset->vertexProperty = vertices;
219 sep->addChild(faceset);
228 SoVertexProperty* verticesL =
new SoVertexProperty();
229 SoIndexedLineSet* lineset =
new SoIndexedLineSet;
233 lineset->coordIndex.set1Value(jj++,
kk++);
235 lineset->coordIndex.set1Value(jj++,
kk++);
237 lineset->coordIndex.set1Value(jj++,
kk++);
239 lineset->coordIndex.set1Value(jj++,
kk++);
240 lineset->coordIndex.set1Value(jj++,SO_END_LINE_INDEX);
242 lineset->vertexProperty = verticesL;
243 sep->addChild(lineset);
◆ generatePrimitives()
void SoTessellated::generatePrimitives |
( |
SoAction * |
action | ) |
|
|
protectedvirtual |
Definition at line 108 of file SoTessellated.cxx.
114 SoState *state =
action->getState();
116 if(
action->getTypeId().isDerivedFrom(SoPickAction::getClassTypeId())) {
120 beginShape(
action,TRIANGLES);
130 glBegin(GL_TRIANGLES);
132 for (
int i=0;
i<nFaces;
i++) {
134 for (
int j = 0; j < 3; j++)
135 glVertex3fv((
const GLfloat*)&
m_points[
i*9+j*3]);
147 const bool transparencyOn = glIsEnabled(GL_BLEND);
149 if (disableLighting) glDisable(GL_LIGHTING);
150 if (transparencyOn) glDisable(GL_BLEND);
153 glBegin(GL_LINE_STRIP);
154 glVertex3fv((
const GLfloat*)&
m_points[
i]);
155 glVertex3fv((
const GLfloat*)&
m_points[
i+3]);
156 glVertex3fv((
const GLfloat*)&
m_points[
i+6]);
157 glVertex3fv((
const GLfloat*)&
m_points[
i]);
161 if (disableLighting) glEnable(GL_LIGHTING);
162 if (transparencyOn) glEnable(GL_BLEND);
166 if (state&&state->isElementEnabled(SoGLCacheContextElement::getClassStackIndex())) {
168 SoGLCacheContextElement::shouldAutoCache(state, SoGLCacheContextElement::DO_AUTO_CACHE);
169 #if ((COIN_MAJOR_VERSION>=3)||((COIN_MAJOR_VERSION==2)&&(COIN_MINOR_VERSION>=5)))
170 SoGLCacheContextElement::incNumShapes(state);
◆ initClass()
void SoTessellated::initClass |
( |
| ) |
|
|
static |
Definition at line 19 of file SoTessellated.cxx.
21 [[maybe_unused]]
static const bool didInit = [&]() {
◆ setupDefaultPoints()
void SoTessellated::setupDefaultPoints |
( |
| ) |
|
|
private |
Definition at line 177 of file SoTessellated.cxx.
179 double targetSize = 100.;
180 addTriangularFacet(-targetSize,-targetSize,0.,targetSize,-targetSize,0.,0.,0.,targetSize);
181 addTriangularFacet(targetSize,-targetSize,0.,targetSize,targetSize,0.,0.,0.,targetSize);
182 addTriangularFacet(targetSize,targetSize,0.,-targetSize,targetSize,0.,0.,0.,targetSize);
183 addTriangularFacet(-targetSize,targetSize,0.,-targetSize,-targetSize,0.,0.,0.,targetSize);
184 addQuadrangularFacet(-targetSize,-targetSize,0.,-targetSize,targetSize,0.,targetSize,targetSize,0.,targetSize,-targetSize,0.);
◆ SO_NODE_HEADER()
◆ alternateRep
SoSFNode SoTessellated::alternateRep |
◆ drawEdgeLines
SoSFBool SoTessellated::drawEdgeLines |
◆ forceEdgeLinesInBaseColour
SoSFBool SoTessellated::forceEdgeLinesInBaseColour |
◆ m_bbox
SbBox3f SoTessellated::m_bbox |
|
private |
◆ m_center
SbVec3f SoTessellated::m_center |
|
private |
◆ m_normals
std::vector<float> SoTessellated::m_normals |
|
private |
◆ m_points
std::vector<float> SoTessellated::m_points |
|
private |
The documentation for this class was generated from the following files:
void addQuadrangularFacet(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4)
void addTriangularFacet(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3)