更新NvTriStrip
This commit is contained in:
parent
d6ebb6a65f
commit
73f282c689
@ -85,12 +85,10 @@ namespace NvTriStrip
|
|||||||
//Cleanup strips / faces, used by generatestrips
|
//Cleanup strips / faces, used by generatestrips
|
||||||
void Cleanup(NvStripInfoVec& tempStrips, NvFaceInfoVec& tempFaces)
|
void Cleanup(NvStripInfoVec& tempStrips, NvFaceInfoVec& tempFaces)
|
||||||
{
|
{
|
||||||
int i,j;
|
|
||||||
|
|
||||||
//delete strips
|
//delete strips
|
||||||
for(i = 0; i < tempStrips.size(); i++)
|
for(unsigned int i = 0; i < tempStrips.size(); i++)
|
||||||
{
|
{
|
||||||
for(j = 0; j < tempStrips[i]->m_faces.size(); j++)
|
for(unsigned int j = 0; j < tempStrips[i]->m_faces.size(); j++)
|
||||||
{
|
{
|
||||||
delete tempStrips[i]->m_faces[j];
|
delete tempStrips[i]->m_faces[j];
|
||||||
tempStrips[i]->m_faces[j] = nullptr;
|
tempStrips[i]->m_faces[j] = nullptr;
|
||||||
@ -101,7 +99,7 @@ namespace NvTriStrip
|
|||||||
}
|
}
|
||||||
|
|
||||||
//delete faces
|
//delete faces
|
||||||
for(i = 0; i < tempFaces.size(); i++)
|
for(unsigned int i = 0; i < tempFaces.size(); i++)
|
||||||
{
|
{
|
||||||
delete tempFaces[i];
|
delete tempFaces[i];
|
||||||
tempFaces[i] = nullptr;
|
tempFaces[i] = nullptr;
|
||||||
@ -154,7 +152,7 @@ namespace NvTriStrip
|
|||||||
//hash this triangle
|
//hash this triangle
|
||||||
bool isLegit = false;
|
bool isLegit = false;
|
||||||
int ctr = v0 % NUMBINS;
|
int ctr = v0 % NUMBINS;
|
||||||
for (int k = 0; k < in_bins[ctr].size(); ++k)
|
for (unsigned int k = 0; k < in_bins[ctr].size(); ++k)
|
||||||
{
|
{
|
||||||
//check triangles in this bin
|
//check triangles in this bin
|
||||||
if (SameTriangle(in_bins[ctr][k].m_v0, in_bins[ctr][k].m_v1, in_bins[ctr][k].m_v2,
|
if (SameTriangle(in_bins[ctr][k].m_v0, in_bins[ctr][k].m_v1, in_bins[ctr][k].m_v2,
|
||||||
@ -167,7 +165,7 @@ namespace NvTriStrip
|
|||||||
if (!isLegit)
|
if (!isLegit)
|
||||||
{
|
{
|
||||||
ctr = v1 % NUMBINS;
|
ctr = v1 % NUMBINS;
|
||||||
for (int k = 0; k < in_bins[ctr].size(); ++k)
|
for (unsigned int k = 0; k < in_bins[ctr].size(); ++k)
|
||||||
{
|
{
|
||||||
//check triangles in this bin
|
//check triangles in this bin
|
||||||
if (SameTriangle(in_bins[ctr][k].m_v0, in_bins[ctr][k].m_v1, in_bins[ctr][k].m_v2,
|
if (SameTriangle(in_bins[ctr][k].m_v0, in_bins[ctr][k].m_v1, in_bins[ctr][k].m_v2,
|
||||||
@ -181,7 +179,7 @@ namespace NvTriStrip
|
|||||||
if (!isLegit)
|
if (!isLegit)
|
||||||
{
|
{
|
||||||
ctr = v2 % NUMBINS;
|
ctr = v2 % NUMBINS;
|
||||||
for (int k = 0; k < in_bins[ctr].size(); ++k)
|
for (unsigned int k = 0; k < in_bins[ctr].size(); ++k)
|
||||||
{
|
{
|
||||||
//check triangles in this bin
|
//check triangles in this bin
|
||||||
if (SameTriangle(in_bins[ctr][k].m_v0, in_bins[ctr][k].m_v1, in_bins[ctr][k].m_v2,
|
if (SameTriangle(in_bins[ctr][k].m_v0, in_bins[ctr][k].m_v1, in_bins[ctr][k].m_v2,
|
||||||
@ -217,7 +215,7 @@ namespace NvTriStrip
|
|||||||
tempIndices.resize(in_numIndices);
|
tempIndices.resize(in_numIndices);
|
||||||
unsigned short maxIndex = 0;
|
unsigned short maxIndex = 0;
|
||||||
unsigned short minIndex = 0xFFFF;
|
unsigned short minIndex = 0xFFFF;
|
||||||
for(int i = 0; i < in_numIndices; i++)
|
for(unsigned int i = 0; i < in_numIndices; i++)
|
||||||
{
|
{
|
||||||
tempIndices[i] = in_indices[i];
|
tempIndices[i] = in_indices[i];
|
||||||
if (in_indices[i] > maxIndex)
|
if (in_indices[i] > maxIndex)
|
||||||
@ -246,7 +244,7 @@ namespace NvTriStrip
|
|||||||
|
|
||||||
//count the total number of indices
|
//count the total number of indices
|
||||||
unsigned int numIndices = 0;
|
unsigned int numIndices = 0;
|
||||||
for(int i = 0; i < tempStrips.size(); i++)
|
for(unsigned int i = 0; i < tempStrips.size(); i++)
|
||||||
{
|
{
|
||||||
numIndices += tempStrips[i]->m_faces.size() * 3;
|
numIndices += tempStrips[i]->m_faces.size() * 3;
|
||||||
}
|
}
|
||||||
@ -260,9 +258,9 @@ namespace NvTriStrip
|
|||||||
|
|
||||||
//do strips
|
//do strips
|
||||||
unsigned int indexCtr = 0;
|
unsigned int indexCtr = 0;
|
||||||
for(int i = 0; i < tempStrips.size(); i++)
|
for(unsigned int i = 0; i < tempStrips.size(); i++)
|
||||||
{
|
{
|
||||||
for(int j = 0; j < tempStrips[i]->m_faces.size(); j++)
|
for(unsigned int j = 0; j < tempStrips[i]->m_faces.size(); j++)
|
||||||
{
|
{
|
||||||
//degenerates are of no use with lists
|
//degenerates are of no use with lists
|
||||||
if(!NvStripifier::IsDegenerate(tempStrips[i]->m_faces[j]))
|
if(!NvStripifier::IsDegenerate(tempStrips[i]->m_faces[j]))
|
||||||
@ -280,7 +278,7 @@ namespace NvTriStrip
|
|||||||
}
|
}
|
||||||
|
|
||||||
//do lists
|
//do lists
|
||||||
for(int i = 0; i < tempFaces.size(); i++)
|
for(unsigned int i = 0; i < tempFaces.size(); i++)
|
||||||
{
|
{
|
||||||
primGroupArray[0].indices[indexCtr++] = tempFaces[i]->m_v0;
|
primGroupArray[0].indices[indexCtr++] = tempFaces[i]->m_v0;
|
||||||
primGroupArray[0].indices[indexCtr++] = tempFaces[i]->m_v1;
|
primGroupArray[0].indices[indexCtr++] = tempFaces[i]->m_v1;
|
||||||
@ -304,14 +302,14 @@ namespace NvTriStrip
|
|||||||
|
|
||||||
//first, the strips
|
//first, the strips
|
||||||
int startingLoc = 0;
|
int startingLoc = 0;
|
||||||
for(int stripCtr = 0; stripCtr < numSeparateStrips; stripCtr++)
|
for(unsigned int stripCtr = 0; stripCtr < numSeparateStrips; stripCtr++)
|
||||||
{
|
{
|
||||||
int stripLength = 0;
|
int stripLength = 0;
|
||||||
|
|
||||||
if(!bStitchStrips)
|
if(!bStitchStrips)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
//if we've got multiple strips, we need to figure out the correct length
|
//if we've got multiple strips, we need to figure out the correct length
|
||||||
|
unsigned int i;
|
||||||
for(i = startingLoc; i < stripIndices.size(); i++)
|
for(i = startingLoc; i < stripIndices.size(); i++)
|
||||||
{
|
{
|
||||||
if(stripIndices[i] == -1)
|
if(stripIndices[i] == -1)
|
||||||
@ -344,7 +342,7 @@ namespace NvTriStrip
|
|||||||
primGroupArray[faceGroupLoc].indices = new unsigned short[tempFaces.size() * 3];
|
primGroupArray[faceGroupLoc].indices = new unsigned short[tempFaces.size() * 3];
|
||||||
primGroupArray[faceGroupLoc].numIndices = tempFaces.size() * 3;
|
primGroupArray[faceGroupLoc].numIndices = tempFaces.size() * 3;
|
||||||
int indexCtr = 0;
|
int indexCtr = 0;
|
||||||
for(int i = 0; i < tempFaces.size(); i++)
|
for(unsigned int i = 0; i < tempFaces.size(); i++)
|
||||||
{
|
{
|
||||||
primGroupArray[faceGroupLoc].indices[indexCtr++] = tempFaces[i]->m_v0;
|
primGroupArray[faceGroupLoc].indices[indexCtr++] = tempFaces[i]->m_v0;
|
||||||
primGroupArray[faceGroupLoc].indices[indexCtr++] = tempFaces[i]->m_v1;
|
primGroupArray[faceGroupLoc].indices[indexCtr++] = tempFaces[i]->m_v1;
|
||||||
@ -361,7 +359,7 @@ namespace NvTriStrip
|
|||||||
std::vector<NvFaceInfo> in_bins[NUMBINS];
|
std::vector<NvFaceInfo> in_bins[NUMBINS];
|
||||||
|
|
||||||
//hash input indices on first index
|
//hash input indices on first index
|
||||||
for (int i = 0; i < in_numIndices; i += 3)
|
for (unsigned int i = 0; i < in_numIndices; i += 3)
|
||||||
{
|
{
|
||||||
NvFaceInfo faceInfo(in_indices[i], in_indices[i + 1], in_indices[i + 2]);
|
NvFaceInfo faceInfo(in_indices[i], in_indices[i + 1], in_indices[i + 2]);
|
||||||
in_bins[in_indices[i] % NUMBINS].push_back(faceInfo);
|
in_bins[in_indices[i] % NUMBINS].push_back(faceInfo);
|
||||||
@ -373,7 +371,7 @@ namespace NvTriStrip
|
|||||||
{
|
{
|
||||||
case PT_LIST:
|
case PT_LIST:
|
||||||
{
|
{
|
||||||
for (int j = 0; j < (*primGroups)[i].numIndices; j += 3)
|
for (unsigned int j = 0; j < (*primGroups)[i].numIndices; j += 3)
|
||||||
{
|
{
|
||||||
unsigned short v0 = (*primGroups)[i].indices[j];
|
unsigned short v0 = (*primGroups)[i].indices[j];
|
||||||
unsigned short v1 = (*primGroups)[i].indices[j + 1];
|
unsigned short v1 = (*primGroups)[i].indices[j + 1];
|
||||||
@ -396,7 +394,7 @@ namespace NvTriStrip
|
|||||||
{
|
{
|
||||||
int brokenCtr = 0;
|
int brokenCtr = 0;
|
||||||
bool flip = false;
|
bool flip = false;
|
||||||
for (int j = 2; j < (*primGroups)[i].numIndices; ++j)
|
for (unsigned int j = 2; j < (*primGroups)[i].numIndices; ++j)
|
||||||
{
|
{
|
||||||
unsigned short v0 = (*primGroups)[i].indices[j - 2];
|
unsigned short v0 = (*primGroups)[i].indices[j - 2];
|
||||||
unsigned short v1 = (*primGroups)[i].indices[j - 1];
|
unsigned short v1 = (*primGroups)[i].indices[j - 1];
|
||||||
@ -478,7 +476,7 @@ namespace NvTriStrip
|
|||||||
(*remappedGroups)[i].numIndices = numIndices;
|
(*remappedGroups)[i].numIndices = numIndices;
|
||||||
(*remappedGroups)[i].indices = new unsigned short[numIndices];
|
(*remappedGroups)[i].indices = new unsigned short[numIndices];
|
||||||
|
|
||||||
for(int j = 0; j < numIndices; j++)
|
for(unsigned int j = 0; j < numIndices; j++)
|
||||||
{
|
{
|
||||||
int cachedIndex = indexCache[in_primGroups[i].indices[j]];
|
int cachedIndex = indexCache[in_primGroups[i].indices[j]];
|
||||||
if(cachedIndex == -1) //we haven't seen this index before
|
if(cachedIndex == -1) //we haven't seen this index before
|
||||||
@ -499,4 +497,4 @@ namespace NvTriStrip
|
|||||||
|
|
||||||
delete[] indexCache;
|
delete[] indexCache;
|
||||||
}
|
}
|
||||||
}//namespace NvTriStrip
|
}//namespace NvTriStrip
|
File diff suppressed because it is too large
Load Diff
@ -2,13 +2,15 @@
|
|||||||
#define NV_TRISTRIP_OBJECTS_H
|
#define NV_TRISTRIP_OBJECTS_H
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <windows.h>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include "VertexCache.h"
|
#include "VertexCache.h"
|
||||||
|
|
||||||
namespace NvTriStrip
|
namespace NvTriStrip
|
||||||
{
|
{
|
||||||
|
typedef unsigned int UINT;
|
||||||
|
typedef long WORD;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Types defined for stripification
|
// Types defined for stripification
|
||||||
@ -27,9 +29,10 @@ namespace NvTriStrip
|
|||||||
float nx, ny, nz;
|
float nx, ny, nz;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class NvFaceInfo {
|
class NvFaceInfo {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// vertex indices
|
// vertex indices
|
||||||
NvFaceInfo(int v0, int v1, int v2, bool bIsFake = false){
|
NvFaceInfo(int v0, int v1, int v2, bool bIsFake = false){
|
||||||
m_v0 = v0; m_v1 = v1; m_v2 = v2;
|
m_v0 = v0; m_v1 = v1; m_v2 = v2;
|
||||||
@ -38,7 +41,7 @@ namespace NvTriStrip
|
|||||||
m_experimentId = -1;
|
m_experimentId = -1;
|
||||||
m_bIsFake = bIsFake;
|
m_bIsFake = bIsFake;
|
||||||
}
|
}
|
||||||
|
|
||||||
// data members are left public
|
// data members are left public
|
||||||
int m_v0, m_v1, m_v2;
|
int m_v0, m_v1, m_v2;
|
||||||
int m_stripId; // real strip Id
|
int m_stripId; // real strip Id
|
||||||
@ -52,7 +55,7 @@ namespace NvTriStrip
|
|||||||
// the lesser of the indices
|
// the lesser of the indices
|
||||||
class NvEdgeInfo {
|
class NvEdgeInfo {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor puts 1 ref on us
|
// constructor puts 1 ref on us
|
||||||
NvEdgeInfo (int v0, int v1){
|
NvEdgeInfo (int v0, int v1){
|
||||||
m_v0 = v0;
|
m_v0 = v0;
|
||||||
@ -61,17 +64,17 @@ namespace NvTriStrip
|
|||||||
m_face1 = nullptr;
|
m_face1 = nullptr;
|
||||||
m_nextV0 = nullptr;
|
m_nextV0 = nullptr;
|
||||||
m_nextV1 = nullptr;
|
m_nextV1 = nullptr;
|
||||||
|
|
||||||
// we will appear in 2 lists. this is a good
|
// we will appear in 2 lists. this is a good
|
||||||
// way to make sure we delete it the second time
|
// way to make sure we delete it the second time
|
||||||
// we hit it in the edge infos
|
// we hit it in the edge infos
|
||||||
m_refCount = 2;
|
m_refCount = 2;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ref and unref
|
// ref and unref
|
||||||
void Unref () { if (--m_refCount == 0) delete this; }
|
void Unref () { if (--m_refCount == 0) delete this; }
|
||||||
|
|
||||||
// data members are left public
|
// data members are left public
|
||||||
UINT m_refCount;
|
UINT m_refCount;
|
||||||
NvFaceInfo *m_face0, *m_face1;
|
NvFaceInfo *m_face0, *m_face1;
|
||||||
@ -93,7 +96,7 @@ namespace NvTriStrip
|
|||||||
}
|
}
|
||||||
NvFaceInfo *m_startFace;
|
NvFaceInfo *m_startFace;
|
||||||
NvEdgeInfo *m_startEdge;
|
NvEdgeInfo *m_startEdge;
|
||||||
bool m_toV1;
|
bool m_toV1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -107,8 +110,8 @@ namespace NvTriStrip
|
|||||||
typedef std::vector<MyVertex> MyVertexVec;
|
typedef std::vector<MyVertex> MyVertexVec;
|
||||||
typedef std::vector<MyFace> MyFaceVec;
|
typedef std::vector<MyFace> MyFaceVec;
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline void SWAP(T& first, T& second)
|
inline void SWAP(T& first, T& second)
|
||||||
{
|
{
|
||||||
T temp = first;
|
T temp = first;
|
||||||
first = second;
|
first = second;
|
||||||
@ -118,7 +121,7 @@ namespace NvTriStrip
|
|||||||
// This is a summary of a strip that has been built
|
// This is a summary of a strip that has been built
|
||||||
class NvStripInfo {
|
class NvStripInfo {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// A little information about the creation of the triangle strips
|
// A little information about the creation of the triangle strips
|
||||||
NvStripInfo(const NvStripStartInfo &startInfo, int stripId, int experimentId = -1) :
|
NvStripInfo(const NvStripStartInfo &startInfo, int stripId, int experimentId = -1) :
|
||||||
m_startInfo(startInfo)
|
m_startInfo(startInfo)
|
||||||
@ -131,71 +134,71 @@ namespace NvTriStrip
|
|||||||
|
|
||||||
// This is an experiment if the experiment id is >= 0
|
// This is an experiment if the experiment id is >= 0
|
||||||
inline bool IsExperiment () const { return m_experimentId >= 0; }
|
inline bool IsExperiment () const { return m_experimentId >= 0; }
|
||||||
|
|
||||||
inline bool IsInStrip (const NvFaceInfo *faceInfo) const
|
inline bool IsInStrip (const NvFaceInfo *faceInfo) const
|
||||||
{
|
{
|
||||||
if(faceInfo == nullptr)
|
if(faceInfo == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return (m_experimentId >= 0 ? faceInfo->m_testStripId == m_stripId : faceInfo->m_stripId == m_stripId);
|
return (m_experimentId >= 0 ? faceInfo->m_testStripId == m_stripId : faceInfo->m_stripId == m_stripId);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SharesEdge(const NvFaceInfo* faceInfo, NvEdgeInfoVec &edgeInfos);
|
bool SharesEdge(const NvFaceInfo* faceInfo, NvEdgeInfoVec &edgeInfos);
|
||||||
|
|
||||||
// take the given forward and backward strips and combine them together
|
// take the given forward and backward strips and combine them together
|
||||||
void Combine(const NvFaceInfoVec &forward, const NvFaceInfoVec &backward);
|
void Combine(const NvFaceInfoVec &forward, const NvFaceInfoVec &backward);
|
||||||
|
|
||||||
//returns true if the face is "unique", i.e. has a vertex which doesn't exist in the faceVec
|
//returns true if the face is "unique", i.e. has a vertex which doesn't exist in the faceVec
|
||||||
bool Unique(NvFaceInfoVec& faceVec, NvFaceInfo* face);
|
bool Unique(NvFaceInfoVec& faceVec, NvFaceInfo* face);
|
||||||
|
|
||||||
// mark the triangle as taken by this strip
|
// mark the triangle as taken by this strip
|
||||||
bool IsMarked (NvFaceInfo *faceInfo);
|
bool IsMarked (NvFaceInfo *faceInfo);
|
||||||
void MarkTriangle(NvFaceInfo *faceInfo);
|
void MarkTriangle(NvFaceInfo *faceInfo);
|
||||||
|
|
||||||
// build the strip
|
// build the strip
|
||||||
void Build(NvEdgeInfoVec &edgeInfos, NvFaceInfoVec &faceInfos);
|
void Build(NvEdgeInfoVec &edgeInfos, NvFaceInfoVec &faceInfos);
|
||||||
|
|
||||||
// public data members
|
// public data members
|
||||||
NvStripStartInfo m_startInfo;
|
NvStripStartInfo m_startInfo;
|
||||||
NvFaceInfoVec m_faces;
|
NvFaceInfoVec m_faces;
|
||||||
int m_stripId;
|
int m_stripId;
|
||||||
int m_experimentId;
|
int m_experimentId;
|
||||||
|
|
||||||
bool visited;
|
bool visited;
|
||||||
|
|
||||||
int m_numDegenerates;
|
int m_numDegenerates;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<NvStripInfo*> NvStripInfoVec;
|
typedef std::vector<NvStripInfo*> NvStripInfoVec;
|
||||||
|
|
||||||
//The actual stripifier
|
//The actual stripifier
|
||||||
class NvStripifier {
|
class NvStripifier {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
NvStripifier()=default;
|
NvStripifier()=default;
|
||||||
~NvStripifier()=default;
|
~NvStripifier()=default;
|
||||||
|
|
||||||
//the target vertex cache size, the structure to place the strips in, and the input indices
|
//the target vertex cache size, the structure to place the strips in, and the input indices
|
||||||
void Stripify(const WordVec &in_indices, const int in_cacheSize, const int in_minStripLength,
|
void Stripify(const WordVec &in_indices, const int in_cacheSize, const int in_minStripLength,
|
||||||
const unsigned short maxIndex, NvStripInfoVec &allStrips, NvFaceInfoVec &allFaces);
|
const unsigned short maxIndex, NvStripInfoVec &allStrips, NvFaceInfoVec &allFaces);
|
||||||
void CreateStrips(const NvStripInfoVec& allStrips, IntVec& stripIndices, const bool bStitchStrips, unsigned int& numSeparateStrips, const bool bRestart, const unsigned int restartVal);
|
void CreateStrips(const NvStripInfoVec& allStrips, IntVec& stripIndices, const bool bStitchStrips, unsigned int& numSeparateStrips, const bool bRestart, const unsigned int restartVal);
|
||||||
|
|
||||||
static int GetUniqueVertexInB(NvFaceInfo *faceA, NvFaceInfo *faceB);
|
static int GetUniqueVertexInB(NvFaceInfo *faceA, NvFaceInfo *faceB);
|
||||||
//static int GetSharedVertex(NvFaceInfo *faceA, NvFaceInfo *faceB);
|
//static int GetSharedVertex(NvFaceInfo *faceA, NvFaceInfo *faceB);
|
||||||
static void GetSharedVertices(NvFaceInfo *faceA, NvFaceInfo *faceB, int* vertex0, int* vertex1);
|
static void GetSharedVertices(NvFaceInfo *faceA, NvFaceInfo *faceB, int* vertex0, int* vertex1);
|
||||||
|
|
||||||
static bool IsDegenerate(const NvFaceInfo* face);
|
static bool IsDegenerate(const NvFaceInfo* face);
|
||||||
static bool IsDegenerate(const unsigned short v0, const unsigned short v1, const unsigned short v2);
|
static bool IsDegenerate(const unsigned short v0, const unsigned short v1, const unsigned short v2);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
WordVec indices;
|
WordVec indices;
|
||||||
int cacheSize;
|
int cacheSize;
|
||||||
int minStripLength;
|
unsigned int minStripLength;
|
||||||
float meshJump;
|
float meshJump;
|
||||||
bool bFirstTimeResetPoint;
|
bool bFirstTimeResetPoint;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Big mess of functions called during stripification
|
// Big mess of functions called during stripification
|
||||||
@ -208,36 +211,36 @@ namespace NvTriStrip
|
|||||||
|
|
||||||
bool IsCW(NvFaceInfo *faceInfo, int v0, int v1);
|
bool IsCW(NvFaceInfo *faceInfo, int v0, int v1);
|
||||||
bool NextIsCW(const int numIndices);
|
bool NextIsCW(const int numIndices);
|
||||||
|
|
||||||
static int GetNextIndex(const WordVec &indices, NvFaceInfo *face);
|
static int GetNextIndex(const WordVec &indices, NvFaceInfo *face);
|
||||||
static NvEdgeInfo *FindEdgeInfo(NvEdgeInfoVec &edgeInfos, int v0, int v1);
|
static NvEdgeInfo *FindEdgeInfo(NvEdgeInfoVec &edgeInfos, int v0, int v1);
|
||||||
static NvFaceInfo *FindOtherFace(NvEdgeInfoVec &edgeInfos, int v0, int v1, NvFaceInfo *faceInfo);
|
static NvFaceInfo *FindOtherFace(NvEdgeInfoVec &edgeInfos, int v0, int v1, NvFaceInfo *faceInfo);
|
||||||
NvFaceInfo *FindGoodResetPoint(NvFaceInfoVec &faceInfos, NvEdgeInfoVec &edgeInfos);
|
NvFaceInfo *FindGoodResetPoint(NvFaceInfoVec &faceInfos, NvEdgeInfoVec &edgeInfos);
|
||||||
|
|
||||||
void FindAllStrips(NvStripInfoVec &allStrips, NvFaceInfoVec &allFaceInfos, NvEdgeInfoVec &allEdgeInfos, int numSamples);
|
void FindAllStrips(NvStripInfoVec &allStrips, NvFaceInfoVec &allFaceInfos, NvEdgeInfoVec &allEdgeInfos, int numSamples);
|
||||||
void SplitUpStripsAndOptimize(NvStripInfoVec &allStrips, NvStripInfoVec &outStrips, NvEdgeInfoVec& edgeInfos, NvFaceInfoVec& outFaceList);
|
void SplitUpStripsAndOptimize(NvStripInfoVec &allStrips, NvStripInfoVec &outStrips, NvEdgeInfoVec& edgeInfos, NvFaceInfoVec& outFaceList);
|
||||||
void RemoveSmallStrips(NvStripInfoVec& allStrips, NvStripInfoVec& allBigStrips, NvFaceInfoVec& faceList);
|
void RemoveSmallStrips(NvStripInfoVec& allStrips, NvStripInfoVec& allBigStrips, NvFaceInfoVec& faceList);
|
||||||
|
|
||||||
bool FindTraversal(NvFaceInfoVec &faceInfos, NvEdgeInfoVec &edgeInfos, NvStripInfo *strip, NvStripStartInfo &startInfo);
|
bool FindTraversal(NvFaceInfoVec &faceInfos, NvEdgeInfoVec &edgeInfos, NvStripInfo *strip, NvStripStartInfo &startInfo);
|
||||||
int CountRemainingTris(std::list<NvStripInfo*>::iterator iter, std::list<NvStripInfo*>::iterator end);
|
int CountRemainingTris(std::list<NvStripInfo*>::iterator iter, std::list<NvStripInfo*>::iterator end);
|
||||||
|
|
||||||
void CommitStrips(NvStripInfoVec &allStrips, const NvStripInfoVec &strips);
|
void CommitStrips(NvStripInfoVec &allStrips, const NvStripInfoVec &strips);
|
||||||
|
|
||||||
float AvgStripSize(const NvStripInfoVec &strips);
|
float AvgStripSize(const NvStripInfoVec &strips);
|
||||||
int FindStartPoint(NvFaceInfoVec &faceInfos, NvEdgeInfoVec &edgeInfos);
|
int FindStartPoint(NvFaceInfoVec &faceInfos, NvEdgeInfoVec &edgeInfos);
|
||||||
|
|
||||||
void UpdateCacheStrip(VertexCache* vcache, NvStripInfo* strip);
|
void UpdateCacheStrip(VertexCache* vcache, NvStripInfo* strip);
|
||||||
void UpdateCacheFace(VertexCache* vcache, NvFaceInfo* face);
|
void UpdateCacheFace(VertexCache* vcache, NvFaceInfo* face);
|
||||||
float CalcNumHitsStrip(VertexCache* vcache, NvStripInfo* strip);
|
float CalcNumHitsStrip(VertexCache* vcache, NvStripInfo* strip);
|
||||||
int CalcNumHitsFace(VertexCache* vcache, NvFaceInfo* face);
|
int CalcNumHitsFace(VertexCache* vcache, NvFaceInfo* face);
|
||||||
int NumNeighbors(NvFaceInfo* face, NvEdgeInfoVec& edgeInfoVec);
|
int NumNeighbors(NvFaceInfo* face, NvEdgeInfoVec& edgeInfoVec);
|
||||||
|
|
||||||
void BuildStripifyInfo(NvFaceInfoVec &faceInfos, NvEdgeInfoVec &edgeInfos, const unsigned short maxIndex);
|
void BuildStripifyInfo(NvFaceInfoVec &faceInfos, NvEdgeInfoVec &edgeInfos, const unsigned short maxIndex);
|
||||||
bool AlreadyExists(NvFaceInfo* faceInfo, NvFaceInfoVec& faceInfos);
|
bool AlreadyExists(NvFaceInfo* faceInfo, NvFaceInfoVec& faceInfos);
|
||||||
|
|
||||||
// let our strip info classes and the other classes get
|
// let our strip info classes and the other classes get
|
||||||
// to these protected stripificaton methods if they want
|
// to these protected stripificaton methods if they want
|
||||||
friend NvStripInfo;
|
friend class NvStripInfo;
|
||||||
};
|
};
|
||||||
}//namespace NvTriStrip
|
}//namespace NvTriStrip
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef VERTEX_CACHE_H
|
#ifndef VERTEX_CACHE_H
|
||||||
#define VERTEX_CACHE_H
|
#define VERTEX_CACHE_H
|
||||||
|
|
||||||
#include<string.h>
|
#include <string.h>
|
||||||
|
|
||||||
namespace NvTriStrip
|
namespace NvTriStrip
|
||||||
{
|
{
|
||||||
@ -20,7 +20,7 @@ namespace NvTriStrip
|
|||||||
}
|
}
|
||||||
|
|
||||||
VertexCache() { VertexCache(16); }
|
VertexCache() { VertexCache(16); }
|
||||||
~VertexCache() { delete[] entries; entries = nullptr; }
|
~VertexCache() { delete[] entries; entries = 0; }
|
||||||
|
|
||||||
bool InCache(int entry)
|
bool InCache(int entry)
|
||||||
{
|
{
|
||||||
@ -74,6 +74,7 @@ namespace NvTriStrip
|
|||||||
|
|
||||||
int *entries;
|
int *entries;
|
||||||
int numEntries;
|
int numEntries;
|
||||||
|
|
||||||
};
|
};
|
||||||
}//namespace NvTriStrip
|
}//namespace NvTriStrip
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user