Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
KennethVanhoey
CGoGN
Commits
2c3b7fb1
Commit
2c3b7fb1
authored
Feb 15, 2013
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some adds in colorPerFace render
parent
71b3c990
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
85 additions
and
0 deletions
+85
-0
include/Algo/Render/GL2/colorPerFaceRender.hpp
include/Algo/Render/GL2/colorPerFaceRender.hpp
+85
-0
No files found.
include/Algo/Render/GL2/colorPerFaceRender.hpp
View file @
2c3b7fb1
...
...
@@ -162,6 +162,91 @@ void ColorPerFaceRender::updateVBO(Utils::VBO& vboPosition, Utils::VBO& vboNorma
/*
template<typename PFP, unsigned int ORBIT>
void ColorPerFaceRender::updateVBO(Utils::VBO& vboPosition, Utils::VBO& vboColor, Utils::VBO& vboTexCoord,
typename PFP::MAP& map,
const VertexAttribute<typename PFP::VEC3>& positions,
const AttributeHandler<typename PFP::VEC3,ORBIT>& colorPerXXX,
CellMarker<VERTEX>& specialVertices,
const VertexAttribute<typename PFP::VEC3>& texCoordPerVertex,
const AttributeHandler<typename PFP::VEC3,VERTEX1>& texCoordPerDart)
{
typedef typename PFP::VEC3 VEC3;
typedef typename PFP::REAL REAL;
std::vector<VEC3> buffer;
buffer.reserve(16384);
std::vector<VEC3> bufferColors;
bufferColors.reserve(16384);
std::vector<VEC3> bufferTC;
bufferColors.reserve(16384);
TraversorCell<typename PFP::MAP, FACE> traFace(map);
for (Dart d=traFace.begin(); d!=traFace.end(); d=traFace.next())
{
Dart a = d;
Dart b = map.phi1(a);
Dart c = map.phi1(b);
// loop to cut a polygon in triangle on the fly (works only with convex faces)
do
{
buffer.push_back(positions[d]);
bufferColors.push_back(colorPerXXX[d]);
if (specialVertices.isMarked(d))
bufferTC.push_back(texCoordPerDart[d]);
else
bufferTC.push_back(texCoordPerVertex[d]);
buffer.push_back(positions[b]);
bufferColors.push_back(colorPerXXX[b]);
if (specialVertices.isMarked(c))
bufferTC.push_back(texCoordPerDart[b]);
else
bufferTC.push_back(texCoordPerVertex[b]);
buffer.push_back(positions[c]);
bufferColors.push_back(colorPerXXX[c]);
if (specialVertices.isMarked(c))
bufferTC.push_back(texCoordPerDart[c]);
else
bufferTC.push_back(texCoordPerVertex[c]);
b = c;
c = map.phi1(b);
} while (c != d);
}
m_nbTris = buffer.size()/3;
vboPosition.setDataSize(3);
vboPosition.allocate(buffer.size());
VEC3* ptrPos = reinterpret_cast<VEC3*>(vboPosition.lockPtr());
memcpy(ptrPos, &buffer[0], buffer.size()*sizeof(VEC3));
vboPosition.releasePtr();
vboTexCoord.setDataSize(2);
vboTexCoord.allocate(bufferTC.size());
VEC3* ptrTC = reinterpret_cast<VEC3*>(vboTexCoord.lockPtr());
memcpy(ptrTC, &bufferTC[0], bufferTC.size()*sizeof(VEC2));
vboTexCoord.releasePtr();
vboColor.setDataSize(3);
vboColor.allocate(bufferColors.size());
VEC3* ptrCol = reinterpret_cast<VEC3*>(vboColor.lockPtr());
memcpy(ptrCol, &bufferColors[0], bufferColors.size()*sizeof(VEC3));
vboColor.releasePtr();
}
*/
inline
void
ColorPerFaceRender
::
draw
(
Utils
::
GLSLShader
*
sh
)
{
sh
->
enableVertexAttribs
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment