Merge pull request #440 from asluk/dev

retain vertex 0 for lefthanded meshes
This commit is contained in:
Takahito Tejima 2015-04-24 22:27:36 -07:00
commit 4d0bd75067
5 changed files with 3162 additions and 3071 deletions

View File

@ -297,7 +297,8 @@ TopologyRefinerFactory<TopologyRefinerFactoryBase::TopologyDescriptor>::assignCo
IndexArray dstFaceVerts = refiner.setBaseFaceVertices(face); IndexArray dstFaceVerts = refiner.setBaseFaceVertices(face);
if (desc.isLeftHanded) { if (desc.isLeftHanded) {
for (int vert=dstFaceVerts.size()-1; vert >=0; --vert) { dstFaceVerts[0] = desc.vertIndicesPerFace[idx++];
for (int vert=dstFaceVerts.size()-1; vert > 0; --vert) {
dstFaceVerts[vert] = desc.vertIndicesPerFace[idx++]; dstFaceVerts[vert] = desc.vertIndicesPerFace[idx++];
} }
@ -381,7 +382,8 @@ TopologyRefinerFactory<TopologyRefinerFactoryBase::TopologyDescriptor>::assignFa
IndexArray dstFaceValues = refiner.setBaseFVarFaceValues(face, channel); IndexArray dstFaceValues = refiner.setBaseFVarFaceValues(face, channel);
if (desc.isLeftHanded) { if (desc.isLeftHanded) {
for (int vert=dstFaceValues.size()-1; vert >= 0; --vert) { dstFaceValues[0] = channelIndices[idx++];
for (int vert=dstFaceValues.size()-1; vert > 0; --vert) {
dstFaceValues[vert] = channelIndices[idx++]; dstFaceValues[vert] = channelIndices[idx++];
} }

View File

@ -212,7 +212,8 @@ TopologyRefinerFactory<Shape>::assignComponentTopology(
//IndexArray dstFaceEdges = refiner.setBaseFaceEdges(i); //IndexArray dstFaceEdges = refiner.setBaseFaceEdges(i);
if (shape.isLeftHanded) { if (shape.isLeftHanded) {
for (int j=dstFaceVerts.size()-1; j>=0; --j) { dstFaceVerts[0] = shape.faceverts[ofs++];
for (int j=dstFaceVerts.size()-1; j>0; --j) {
dstFaceVerts[j] = shape.faceverts[ofs++]; dstFaceVerts[j] = shape.faceverts[ofs++];
} }
} else { } else {
@ -243,7 +244,8 @@ TopologyRefinerFactory<Shape>::assignFaceVaryingTopology(
refiner.setBaseFVarFaceValues(i, channel); refiner.setBaseFVarFaceValues(i, channel);
if (shape.isLeftHanded) { if (shape.isLeftHanded) {
for (int j=dstFaceUVs.size()-1; j >= 0; --j) { dstFaceUVs[0] = shape.faceuvs[ofs++];
for (int j=dstFaceUVs.size()-1; j > 0; --j) {
dstFaceUVs[j] = shape.faceuvs[ofs++]; dstFaceUVs[j] = shape.faceuvs[ofs++];
} }
} else { } else {

View File

@ -26,12 +26,14 @@
struct ShapeDesc { struct ShapeDesc {
ShapeDesc(char const * iname, std::string const & idata, Scheme ischeme) : ShapeDesc(char const * iname, std::string const & idata, Scheme ischeme,
name(iname), data(idata), scheme(ischeme) { } bool iisLeftHanded=false) :
name(iname), data(idata), scheme(ischeme), isLeftHanded(iisLeftHanded) { }
std::string name, std::string name,
data; data;
Scheme scheme; Scheme scheme;
bool isLeftHanded;
}; };
static std::vector<ShapeDesc> g_shapes; static std::vector<ShapeDesc> g_shapes;
@ -61,6 +63,7 @@ static std::vector<ShapeDesc> g_shapes;
#include "../shapes/catmark_gregory_test4.h" #include "../shapes/catmark_gregory_test4.h"
#include "../shapes/catmark_gregory_test5.h" #include "../shapes/catmark_gregory_test5.h"
#include "../shapes/catmark_helmet.h" #include "../shapes/catmark_helmet.h"
#include "../shapes/catmark_lefthanded.h"
#include "../shapes/catmark_pyramid_creases0.h" #include "../shapes/catmark_pyramid_creases0.h"
#include "../shapes/catmark_pyramid_creases1.h" #include "../shapes/catmark_pyramid_creases1.h"
#include "../shapes/catmark_pyramid.h" #include "../shapes/catmark_pyramid.h"
@ -124,6 +127,7 @@ static void initShapes() {
g_shapes.push_back( ShapeDesc("catmark_torus", catmark_torus, kCatmark ) ); g_shapes.push_back( ShapeDesc("catmark_torus", catmark_torus, kCatmark ) );
g_shapes.push_back( ShapeDesc("catmark_torus_creases0", catmark_torus_creases0, kCatmark ) ); g_shapes.push_back( ShapeDesc("catmark_torus_creases0", catmark_torus_creases0, kCatmark ) );
g_shapes.push_back( ShapeDesc("catmark_helmet", catmark_helmet, kCatmark ) ); g_shapes.push_back( ShapeDesc("catmark_helmet", catmark_helmet, kCatmark ) );
g_shapes.push_back( ShapeDesc("catmark_lefthanded", catmark_lefthanded, kCatmark, true /*isLeftHanded*/) );
g_shapes.push_back( ShapeDesc("loop_cube_creases0", loop_cube_creases0, kLoop ) ); g_shapes.push_back( ShapeDesc("loop_cube_creases0", loop_cube_creases0, kLoop ) );
g_shapes.push_back( ShapeDesc("loop_cube_creases1", loop_cube_creases1, kLoop ) ); g_shapes.push_back( ShapeDesc("loop_cube_creases1", loop_cube_creases1, kLoop ) );

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff