mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-11-08 13:30:04 +00:00
Removed obsolete references to hbr from farViewer
This commit is contained in:
parent
62ddd17bcb
commit
cc60e9eda3
@ -26,14 +26,13 @@
|
||||
#define GL_MESH_H
|
||||
|
||||
#include "../../regression/common/far_utils.h"
|
||||
#include "../../regression/common/hbr_utils.h"
|
||||
#include <opensubdiv/far/patchTable.h>
|
||||
|
||||
#include "../common/glUtils.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
// Wrapper class for drawing Hbr & Far meshes & components
|
||||
// Wrapper class for drawing Far meshes & components
|
||||
class GLMesh {
|
||||
|
||||
public:
|
||||
@ -77,118 +76,6 @@ public:
|
||||
int nverts, int nfaces, int * vertsperface, int * faceverts,
|
||||
float const * vertexData);
|
||||
|
||||
|
||||
// -----------------------------------------------------
|
||||
// Hbr initialization
|
||||
template <class T>
|
||||
void Initialize(Options options,
|
||||
std::vector<OpenSubdiv::HbrFace<T> const *> const & faces) {
|
||||
|
||||
assert(!faces.empty());
|
||||
|
||||
OpenSubdiv::HbrMesh<T> const * hmesh = faces[0]->GetMesh();
|
||||
|
||||
int nfaces = (int)faces.size(),
|
||||
nverts = hmesh->GetNumVertices(),
|
||||
nedgeverts = 0;
|
||||
|
||||
{ // EAOs ------------------------------------------
|
||||
_eao[COMP_VERT].reserve(nfaces*4);
|
||||
_eao[COMP_FACE].reserve(nfaces*4);
|
||||
for (int i=0; i<nfaces; ++i) {
|
||||
|
||||
OpenSubdiv::HbrFace<T> const * f = faces[i];
|
||||
|
||||
int nv = f->GetNumVertices();
|
||||
for (int j=0; j<nv; ++j) {
|
||||
int vid = f->GetVertex(j)->GetID();
|
||||
_eao[COMP_VERT].push_back(vid);
|
||||
_eao[COMP_FACE].push_back(vid);
|
||||
}
|
||||
}
|
||||
std::sort(_eao[COMP_VERT].begin(), _eao[COMP_VERT].end());
|
||||
std::unique(_eao[COMP_VERT].begin(), _eao[COMP_VERT].end()); // XXXX this might be slow...
|
||||
|
||||
nedgeverts = (int)_eao[COMP_FACE].size()*2;
|
||||
_eao[COMP_EDGE].resize(nedgeverts);
|
||||
for (int i=0; i<nedgeverts; ++i) {
|
||||
_eao[COMP_EDGE][i]=i;
|
||||
}
|
||||
}
|
||||
|
||||
{ // VBOs ------------------------------------------
|
||||
_vbo[COMP_VERT].resize(nverts*6);
|
||||
_vbo[COMP_FACE].resize(nverts*3);
|
||||
for (int i=0; i<nverts; ++i) {
|
||||
|
||||
OpenSubdiv::HbrVertex<T> const * v = hmesh->GetVertex(i);
|
||||
|
||||
float * vertdata = &_vbo[COMP_VERT][v->GetID()*6],
|
||||
* facedata = &_vbo[COMP_FACE][v->GetID()*3];
|
||||
|
||||
// copy position
|
||||
memcpy(vertdata, v->GetData().GetPos(), sizeof(float)*3);
|
||||
memcpy(facedata, v->GetData().GetPos(), sizeof(float)*3);
|
||||
|
||||
// set color
|
||||
if (options.vertColorMode==VERTCOLOR_BY_LEVEL) {
|
||||
int depth=0;
|
||||
if (v->IsConnected()) {
|
||||
depth = v->GetIncidentEdge()->GetFace()->GetDepth();
|
||||
}
|
||||
setColorByLevel(depth, vertdata+3);
|
||||
} else if (options.vertColorMode==VERTCOLOR_BY_SHARPNESS) {
|
||||
setColorBySharpness(v->GetSharpness(), vertdata+3);
|
||||
} else {
|
||||
setSolidColor(vertdata+3);
|
||||
}
|
||||
}
|
||||
|
||||
_vbo[COMP_EDGE].resize(nedgeverts*6);
|
||||
for (int i=0, ofs=0; i<nfaces; ++i) {
|
||||
|
||||
OpenSubdiv::HbrFace<T> const * f = faces[i];
|
||||
int nv = f->GetNumVertices();
|
||||
for (int j=0; j<nv; ++j) {
|
||||
|
||||
OpenSubdiv::HbrHalfedge<T> const * e = f->GetEdge(j);
|
||||
OpenSubdiv::HbrVertex<T> const * v0 = e->GetOrgVertex(),
|
||||
* v1 = e->GetDestVertex();
|
||||
|
||||
float * v0data = &_vbo[COMP_EDGE][ofs],
|
||||
* v1data = &_vbo[COMP_EDGE][ofs+6];
|
||||
|
||||
// copy position
|
||||
memcpy(v0data, v0->GetData().GetPos(), sizeof(float)*3);
|
||||
memcpy(v1data, v1->GetData().GetPos(), sizeof(float)*3);
|
||||
|
||||
// set color
|
||||
if (options.vertColorMode==EDGECOLOR_BY_LEVEL) {
|
||||
|
||||
int depth = f->GetDepth();
|
||||
setColorByLevel(depth, v0data+3);
|
||||
setColorByLevel(depth, v1data+3);
|
||||
} else if (options.vertColorMode==EDGECOLOR_BY_SHARPNESS) {
|
||||
|
||||
setColorBySharpness(e->GetSharpness(), v0data+3);
|
||||
setColorBySharpness(e->GetSharpness(), v1data+3);
|
||||
} else {
|
||||
|
||||
setSolidColor(v0data+3);
|
||||
setSolidColor(v1data+3);
|
||||
}
|
||||
ofs += 12;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_numComps[COMP_FACE] = (int)_eao[COMP_FACE].size();
|
||||
_numComps[COMP_EDGE] = (int)_eao[COMP_EDGE].size();
|
||||
_numComps[COMP_VERT] = (int)_eao[COMP_VERT].size();
|
||||
|
||||
_faceColors.resize(nfaces*4, 1.0f);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------
|
||||
// Far initialization
|
||||
typedef OpenSubdiv::Far::TopologyRefiner TopologyRefiner;
|
||||
|
Loading…
Reference in New Issue
Block a user