Skip to content
Browse files

Fix CRLF.

  • Loading branch information...
1 parent 7a23d00 commit b986174d2fde82126b1c00a22f4c278a9c54ef40 @amorilia amorilia committed Nov 26, 2009
View
152 NifSkope.pro
@@ -1,76 +1,76 @@
-TEMPLATE = app
-LANGUAGE = C++
-TARGET = NifSkope
-
-QT += xml opengl network
-
-CONFIG += qt release thread warn_on
-
-CONFIG += fsengine
-
-# uncomment this if you want all the messages to be logged to stdout
-#CONFIG += console
-
-# uncomment this if you want the text stats gl option
-#DEFINES += USE_GL_QPAINTER
-
-# On Windows this builds Release in release/ and Debug in debug/
-# On Linux you may need CONFIG += debug_and_release debug_and_release_target
-DESTDIR = .
-
-HEADERS += \
- *.h \
- gl/*.h \
- gl/marker/*.h \
- gl/dds/*.h \
- widgets/*.h \
- spells/*.h \
- importex/*.h \
- NvTriStrip/qtwrapper.h
-
-SOURCES += \
- *.cpp \
- gl/*.cpp \
- gl/dds/*.cpp \
- widgets/*.cpp \
- spells/*.cpp \
- importex/*.cpp \
- NvTriStrip/*.cpp
-
-RESOURCES += \
- nifskope.qrc
-
-fsengine {
- DEFINES += FSENGINE
- HEADERS += fsengine/*.h
- SOURCES += fsengine/*.cpp
-}
-
-win32 {
- # useful for MSVC2005
- CONFIG += embed_manifest_exe
- CONFIG -= flat
-
- RC_FILE = icon.rc
- DEFINES += EDIT_ON_ACTIVATE
-
- # Ignore specific errors that are very common in the code
- # CFLAGS += /Zc:wchar_t-
- # QMAKE_CFLAGS += /Zc:wchar_t- /wd4305
- # QMAKE_CXXFLAGS += /Zc:forScope- /Zc:wchar_t- /wd4305
-
- # add specific libraries to msvc builds
- MSVCPROJ_LIBS += winmm.lib Ws2_32.lib imm32.lib
-}
-
-win32:console {
- LIBS += -lqtmain
-}
-
-console {
- DEFINES += NO_MESSAGEHANDLER
-}
-
-TRANSLATIONS += lang/NifSkope_de.ts lang/NifSkope_fr.ts
-
-# vim: set filetype=config :
+TEMPLATE = app
+LANGUAGE = C++
+TARGET = NifSkope
+
+QT += xml opengl network
+
+CONFIG += qt release thread warn_on
+
+CONFIG += fsengine
+
+# uncomment this if you want all the messages to be logged to stdout
+#CONFIG += console
+
+# uncomment this if you want the text stats gl option
+#DEFINES += USE_GL_QPAINTER
+
+# On Windows this builds Release in release/ and Debug in debug/
+# On Linux you may need CONFIG += debug_and_release debug_and_release_target
+DESTDIR = .
+
+HEADERS += \
+ *.h \
+ gl/*.h \
+ gl/marker/*.h \
+ gl/dds/*.h \
+ widgets/*.h \
+ spells/*.h \
+ importex/*.h \
+ NvTriStrip/qtwrapper.h
+
+SOURCES += \
+ *.cpp \
+ gl/*.cpp \
+ gl/dds/*.cpp \
+ widgets/*.cpp \
+ spells/*.cpp \
+ importex/*.cpp \
+ NvTriStrip/*.cpp
+
+RESOURCES += \
+ nifskope.qrc
+
+fsengine {
+ DEFINES += FSENGINE
+ HEADERS += fsengine/*.h
+ SOURCES += fsengine/*.cpp
+}
+
+win32 {
+ # useful for MSVC2005
+ CONFIG += embed_manifest_exe
+ CONFIG -= flat
+
+ RC_FILE = icon.rc
+ DEFINES += EDIT_ON_ACTIVATE
+
+ # Ignore specific errors that are very common in the code
+ # CFLAGS += /Zc:wchar_t-
+ # QMAKE_CFLAGS += /Zc:wchar_t- /wd4305
+ # QMAKE_CXXFLAGS += /Zc:forScope- /Zc:wchar_t- /wd4305
+
+ # add specific libraries to msvc builds
+ MSVCPROJ_LIBS += winmm.lib Ws2_32.lib imm32.lib
+}
+
+win32:console {
+ LIBS += -lqtmain
+}
+
+console {
+ DEFINES += NO_MESSAGEHANDLER
+}
+
+TRANSLATIONS += lang/NifSkope_de.ts lang/NifSkope_fr.ts
+
+# vim: set filetype=config :
View
994 NvTriStrip/NvTriStrip.cpp
@@ -1,499 +1,499 @@
-
-#include "NvTriStripObjects.h"
-#include "NvTriStrip.h"
+
+#include "NvTriStripObjects.h"
+#include "NvTriStrip.h"
#include <string.h> // memset
-
-////////////////////////////////////////////////////////////////////////////////////////
-//private data
-static unsigned int cacheSize = CACHESIZE_GEFORCE1_2;
-static bool bStitchStrips = true;
-static unsigned int minStripSize = 0;
-static bool bListsOnly = false;
-static unsigned int restartVal = 0;
-static bool bRestart = false;
-
-void EnableRestart(const unsigned int _restartVal)
-{
- bRestart = true;
- restartVal = _restartVal;
-}
-
-void DisableRestart()
-{
- bRestart = false;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////
-// SetListsOnly()
-//
-// If set to true, will return an optimized list, with no strips at all.
-//
-// Default value: false
-//
-void SetListsOnly(const bool _bListsOnly)
-{
- bListsOnly = _bListsOnly;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////
-// SetCacheSize()
-//
-// Sets the cache size which the stripfier uses to optimize the data.
-// Controls the length of the generated individual strips.
-// This is the "actual" cache size, so 24 for GeForce3 and 16 for GeForce1/2
-// You may want to play around with this number to tweak performance.
-//
-// Default value: 16
-//
-void SetCacheSize(const unsigned int _cacheSize)
-{
- cacheSize = _cacheSize;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-// SetStitchStrips()
-//
-// bool to indicate whether to stitch together strips into one huge strip or not.
-// If set to true, you'll get back one huge strip stitched together using degenerate
-// triangles.
-// If set to false, you'll get back a large number of separate strips.
-//
-// Default value: true
-//
-void SetStitchStrips(const bool _bStitchStrips)
-{
- bStitchStrips = _bStitchStrips;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-// SetMinStripSize()
-//
-// Sets the minimum acceptable size for a strip, in triangles.
-// All strips generated which are shorter than this will be thrown into one big, separate list.
-//
-// Default value: 0
-//
-void SetMinStripSize(const unsigned int _minStripSize)
-{
- minStripSize = _minStripSize;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-//Cleanup strips / faces, used by generatestrips
-void Cleanup(NvStripInfoVec& tempStrips, NvFaceInfoVec& tempFaces)
-{
- //delete strips
- for(size_t i = 0; i < tempStrips.size(); i++)
- {
- for(size_t j = 0; j < tempStrips[i]->m_faces.size(); j++)
- {
- delete tempStrips[i]->m_faces[j];
- tempStrips[i]->m_faces[j] = NULL;
- }
- tempStrips[i]->m_faces.resize(0);
- delete tempStrips[i];
- tempStrips[i] = NULL;
- }
-
- //delete faces
- for(size_t i = 0; i < tempFaces.size(); i++)
- {
- delete tempFaces[i];
- tempFaces[i] = NULL;
- }
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-//SameTriangle()
-//
-//Returns true if the two triangles defined by firstTri and secondTri are the same
-// The "same" is defined in this case as having the same indices with the same winding order
-//
-bool SameTriangle(unsigned short firstTri0, unsigned short firstTri1, unsigned short firstTri2,
- unsigned short secondTri0, unsigned short secondTri1, unsigned short secondTri2)
-{
- bool isSame = false;
-
- if (firstTri0 == secondTri0)
- {
- if (firstTri1 == secondTri1)
- {
- if (firstTri2 == secondTri2)
- isSame = true;
- }
- }
- else if (firstTri0 == secondTri1)
- {
- if (firstTri1 == secondTri2)
- {
- if (firstTri2 == secondTri0)
- isSame = true;
- }
- }
- else if (firstTri0 == secondTri2)
- {
- if (firstTri1 == secondTri0)
- {
- if (firstTri2 == secondTri1)
- isSame = true;
- }
- }
-
- return isSame;
-}
-
-
-bool TestTriangle(const unsigned short v0, const unsigned short v1, const unsigned short v2, const std::vector<NvFaceInfo>* in_bins, const int NUMBINS)
-{
- //hash this triangle
- bool isLegit = false;
- int ctr = v0 % NUMBINS;
- for (size_t k = 0; k < in_bins[ctr].size(); ++k)
- {
- //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,
- v0, v1, v2))
- {
- isLegit = true;
- break;
- }
- }
- if (!isLegit)
- {
- ctr = v1 % NUMBINS;
- for (size_t k = 0; k < in_bins[ctr].size(); ++k)
- {
- //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,
- v0, v1, v2))
- {
- isLegit = true;
- break;
- }
- }
-
- if (!isLegit)
- {
- ctr = v2 % NUMBINS;
- for (size_t k = 0; k < in_bins[ctr].size(); ++k)
- {
- //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,
- v0, v1, v2))
- {
- isLegit = true;
- break;
- }
- }
-
- }
- }
-
- return isLegit;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-// GenerateStrips()
-//
-// in_indices: input index list, the indices you would use to render
-// in_numIndices: number of entries in in_indices
-// primGroups: array of optimized/stripified PrimitiveGroups
-// numGroups: number of groups returned
-//
-// Be sure to call delete[] on the returned primGroups to avoid leaking mem
-//
-bool GenerateStrips(const unsigned short* in_indices, const unsigned int in_numIndices,
- PrimitiveGroup** primGroups, unsigned short* numGroups, bool validateEnabled)
-{
- //put data in format that the stripifier likes
- WordVec tempIndices;
- tempIndices.resize(in_numIndices);
- unsigned short maxIndex = 0;
- unsigned short minIndex = 0xFFFF;
- for(size_t i = 0; i < in_numIndices; i++)
- {
- tempIndices[i] = in_indices[i];
- if (in_indices[i] > maxIndex)
- maxIndex = in_indices[i];
- if (in_indices[i] < minIndex)
- minIndex = in_indices[i];
- }
- NvStripInfoVec tempStrips;
- NvFaceInfoVec tempFaces;
-
- NvStripifier stripifier;
-
- //do actual stripification
- stripifier.Stripify(tempIndices, cacheSize, minStripSize, maxIndex, tempStrips, tempFaces);
-
- //stitch strips together
- IntVec stripIndices;
- unsigned int numSeparateStrips = 0;
-
- if(bListsOnly)
- {
- //if we're outputting only lists, we're done
- *numGroups = 1;
- (*primGroups) = new PrimitiveGroup[*numGroups];
- PrimitiveGroup* primGroupArray = *primGroups;
-
- //count the total number of indices
- unsigned int numIndices = 0;
- for(size_t i = 0; i < tempStrips.size(); i++)
- {
- numIndices += tempStrips[i]->m_faces.size() * 3;
- }
-
- //add in the list
- numIndices += tempFaces.size() * 3;
-
- primGroupArray[0].type = PT_LIST;
- primGroupArray[0].numIndices = numIndices;
- primGroupArray[0].indices = new unsigned short[numIndices];
-
- //do strips
- unsigned int indexCtr = 0;
- for(size_t i = 0; i < tempStrips.size(); i++)
- {
- for(size_t j = 0; j < tempStrips[i]->m_faces.size(); j++)
- {
- //degenerates are of no use with lists
- if(!NvStripifier::IsDegenerate(tempStrips[i]->m_faces[j]))
- {
- primGroupArray[0].indices[indexCtr++] = tempStrips[i]->m_faces[j]->m_v0;
- primGroupArray[0].indices[indexCtr++] = tempStrips[i]->m_faces[j]->m_v1;
- primGroupArray[0].indices[indexCtr++] = tempStrips[i]->m_faces[j]->m_v2;
- }
- else
- {
- //we've removed a tri, reduce the number of indices
- primGroupArray[0].numIndices -= 3;
- }
- }
- }
-
- //do lists
- for(size_t i = 0; i < tempFaces.size(); i++)
- {
- primGroupArray[0].indices[indexCtr++] = tempFaces[i]->m_v0;
- primGroupArray[0].indices[indexCtr++] = tempFaces[i]->m_v1;
- primGroupArray[0].indices[indexCtr++] = tempFaces[i]->m_v2;
- }
- }
- else
- {
- stripifier.CreateStrips(tempStrips, stripIndices, bStitchStrips, numSeparateStrips, bRestart, restartVal);
-
- //if we're stitching strips together, we better get back only one strip from CreateStrips()
- assert( (bStitchStrips && (numSeparateStrips == 1)) || !bStitchStrips);
-
- //convert to output format
- *numGroups = numSeparateStrips; //for the strips
- if(tempFaces.size() != 0)
- (*numGroups)++; //we've got a list as well, increment
- (*primGroups) = new PrimitiveGroup[*numGroups];
-
- PrimitiveGroup* primGroupArray = *primGroups;
-
- //first, the strips
- int startingLoc = 0;
- for(size_t stripCtr = 0; stripCtr < numSeparateStrips; stripCtr++)
- {
- int stripLength = 0;
-
- if(!bStitchStrips)
- {
+
+////////////////////////////////////////////////////////////////////////////////////////
+//private data
+static unsigned int cacheSize = CACHESIZE_GEFORCE1_2;
+static bool bStitchStrips = true;
+static unsigned int minStripSize = 0;
+static bool bListsOnly = false;
+static unsigned int restartVal = 0;
+static bool bRestart = false;
+
+void EnableRestart(const unsigned int _restartVal)
+{
+ bRestart = true;
+ restartVal = _restartVal;
+}
+
+void DisableRestart()
+{
+ bRestart = false;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////
+// SetListsOnly()
+//
+// If set to true, will return an optimized list, with no strips at all.
+//
+// Default value: false
+//
+void SetListsOnly(const bool _bListsOnly)
+{
+ bListsOnly = _bListsOnly;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////
+// SetCacheSize()
+//
+// Sets the cache size which the stripfier uses to optimize the data.
+// Controls the length of the generated individual strips.
+// This is the "actual" cache size, so 24 for GeForce3 and 16 for GeForce1/2
+// You may want to play around with this number to tweak performance.
+//
+// Default value: 16
+//
+void SetCacheSize(const unsigned int _cacheSize)
+{
+ cacheSize = _cacheSize;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////
+// SetStitchStrips()
+//
+// bool to indicate whether to stitch together strips into one huge strip or not.
+// If set to true, you'll get back one huge strip stitched together using degenerate
+// triangles.
+// If set to false, you'll get back a large number of separate strips.
+//
+// Default value: true
+//
+void SetStitchStrips(const bool _bStitchStrips)
+{
+ bStitchStrips = _bStitchStrips;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////
+// SetMinStripSize()
+//
+// Sets the minimum acceptable size for a strip, in triangles.
+// All strips generated which are shorter than this will be thrown into one big, separate list.
+//
+// Default value: 0
+//
+void SetMinStripSize(const unsigned int _minStripSize)
+{
+ minStripSize = _minStripSize;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////
+//Cleanup strips / faces, used by generatestrips
+void Cleanup(NvStripInfoVec& tempStrips, NvFaceInfoVec& tempFaces)
+{
+ //delete strips
+ for(size_t i = 0; i < tempStrips.size(); i++)
+ {
+ for(size_t j = 0; j < tempStrips[i]->m_faces.size(); j++)
+ {
+ delete tempStrips[i]->m_faces[j];
+ tempStrips[i]->m_faces[j] = NULL;
+ }
+ tempStrips[i]->m_faces.resize(0);
+ delete tempStrips[i];
+ tempStrips[i] = NULL;
+ }
+
+ //delete faces
+ for(size_t i = 0; i < tempFaces.size(); i++)
+ {
+ delete tempFaces[i];
+ tempFaces[i] = NULL;
+ }
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////
+//SameTriangle()
+//
+//Returns true if the two triangles defined by firstTri and secondTri are the same
+// The "same" is defined in this case as having the same indices with the same winding order
+//
+bool SameTriangle(unsigned short firstTri0, unsigned short firstTri1, unsigned short firstTri2,
+ unsigned short secondTri0, unsigned short secondTri1, unsigned short secondTri2)
+{
+ bool isSame = false;
+
+ if (firstTri0 == secondTri0)
+ {
+ if (firstTri1 == secondTri1)
+ {
+ if (firstTri2 == secondTri2)
+ isSame = true;
+ }
+ }
+ else if (firstTri0 == secondTri1)
+ {
+ if (firstTri1 == secondTri2)
+ {
+ if (firstTri2 == secondTri0)
+ isSame = true;
+ }
+ }
+ else if (firstTri0 == secondTri2)
+ {
+ if (firstTri1 == secondTri0)
+ {
+ if (firstTri2 == secondTri1)
+ isSame = true;
+ }
+ }
+
+ return isSame;
+}
+
+
+bool TestTriangle(const unsigned short v0, const unsigned short v1, const unsigned short v2, const std::vector<NvFaceInfo>* in_bins, const int NUMBINS)
+{
+ //hash this triangle
+ bool isLegit = false;
+ int ctr = v0 % NUMBINS;
+ for (size_t k = 0; k < in_bins[ctr].size(); ++k)
+ {
+ //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,
+ v0, v1, v2))
+ {
+ isLegit = true;
+ break;
+ }
+ }
+ if (!isLegit)
+ {
+ ctr = v1 % NUMBINS;
+ for (size_t k = 0; k < in_bins[ctr].size(); ++k)
+ {
+ //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,
+ v0, v1, v2))
+ {
+ isLegit = true;
+ break;
+ }
+ }
+
+ if (!isLegit)
+ {
+ ctr = v2 % NUMBINS;
+ for (size_t k = 0; k < in_bins[ctr].size(); ++k)
+ {
+ //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,
+ v0, v1, v2))
+ {
+ isLegit = true;
+ break;
+ }
+ }
+
+ }
+ }
+
+ return isLegit;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////
+// GenerateStrips()
+//
+// in_indices: input index list, the indices you would use to render
+// in_numIndices: number of entries in in_indices
+// primGroups: array of optimized/stripified PrimitiveGroups
+// numGroups: number of groups returned
+//
+// Be sure to call delete[] on the returned primGroups to avoid leaking mem
+//
+bool GenerateStrips(const unsigned short* in_indices, const unsigned int in_numIndices,
+ PrimitiveGroup** primGroups, unsigned short* numGroups, bool validateEnabled)
+{
+ //put data in format that the stripifier likes
+ WordVec tempIndices;
+ tempIndices.resize(in_numIndices);
+ unsigned short maxIndex = 0;
+ unsigned short minIndex = 0xFFFF;
+ for(size_t i = 0; i < in_numIndices; i++)
+ {
+ tempIndices[i] = in_indices[i];
+ if (in_indices[i] > maxIndex)
+ maxIndex = in_indices[i];
+ if (in_indices[i] < minIndex)
+ minIndex = in_indices[i];
+ }
+ NvStripInfoVec tempStrips;
+ NvFaceInfoVec tempFaces;
+
+ NvStripifier stripifier;
+
+ //do actual stripification
+ stripifier.Stripify(tempIndices, cacheSize, minStripSize, maxIndex, tempStrips, tempFaces);
+
+ //stitch strips together
+ IntVec stripIndices;
+ unsigned int numSeparateStrips = 0;
+
+ if(bListsOnly)
+ {
+ //if we're outputting only lists, we're done
+ *numGroups = 1;
+ (*primGroups) = new PrimitiveGroup[*numGroups];
+ PrimitiveGroup* primGroupArray = *primGroups;
+
+ //count the total number of indices
+ unsigned int numIndices = 0;
+ for(size_t i = 0; i < tempStrips.size(); i++)
+ {
+ numIndices += tempStrips[i]->m_faces.size() * 3;
+ }
+
+ //add in the list
+ numIndices += tempFaces.size() * 3;
+
+ primGroupArray[0].type = PT_LIST;
+ primGroupArray[0].numIndices = numIndices;
+ primGroupArray[0].indices = new unsigned short[numIndices];
+
+ //do strips
+ unsigned int indexCtr = 0;
+ for(size_t i = 0; i < tempStrips.size(); i++)
+ {
+ for(size_t j = 0; j < tempStrips[i]->m_faces.size(); j++)
+ {
+ //degenerates are of no use with lists
+ if(!NvStripifier::IsDegenerate(tempStrips[i]->m_faces[j]))
+ {
+ primGroupArray[0].indices[indexCtr++] = tempStrips[i]->m_faces[j]->m_v0;
+ primGroupArray[0].indices[indexCtr++] = tempStrips[i]->m_faces[j]->m_v1;
+ primGroupArray[0].indices[indexCtr++] = tempStrips[i]->m_faces[j]->m_v2;
+ }
+ else
+ {
+ //we've removed a tri, reduce the number of indices
+ primGroupArray[0].numIndices -= 3;
+ }
+ }
+ }
+
+ //do lists
+ for(size_t i = 0; i < tempFaces.size(); i++)
+ {
+ primGroupArray[0].indices[indexCtr++] = tempFaces[i]->m_v0;
+ primGroupArray[0].indices[indexCtr++] = tempFaces[i]->m_v1;
+ primGroupArray[0].indices[indexCtr++] = tempFaces[i]->m_v2;
+ }
+ }
+ else
+ {
+ stripifier.CreateStrips(tempStrips, stripIndices, bStitchStrips, numSeparateStrips, bRestart, restartVal);
+
+ //if we're stitching strips together, we better get back only one strip from CreateStrips()
+ assert( (bStitchStrips && (numSeparateStrips == 1)) || !bStitchStrips);
+
+ //convert to output format
+ *numGroups = numSeparateStrips; //for the strips
+ if(tempFaces.size() != 0)
+ (*numGroups)++; //we've got a list as well, increment
+ (*primGroups) = new PrimitiveGroup[*numGroups];
+
+ PrimitiveGroup* primGroupArray = *primGroups;
+
+ //first, the strips
+ int startingLoc = 0;
+ for(size_t stripCtr = 0; stripCtr < numSeparateStrips; stripCtr++)
+ {
+ int stripLength = 0;
+
+ if(!bStitchStrips)
+ {
//if we've got multiple strips, we need to figure out the correct length
- size_t i;
- for(i = startingLoc; i < stripIndices.size(); i++)
- {
- if(stripIndices[i] == -1)
- break;
- }
-
- stripLength = i - startingLoc;
- }
- else
- stripLength = stripIndices.size();
-
- primGroupArray[stripCtr].type = PT_STRIP;
- primGroupArray[stripCtr].indices = new unsigned short[stripLength];
- primGroupArray[stripCtr].numIndices = stripLength;
-
- int indexCtr = 0;
- for(int i = startingLoc; i < stripLength + startingLoc; i++)
- primGroupArray[stripCtr].indices[indexCtr++] = stripIndices[i];
-
- //we add 1 to account for the -1 separating strips
- //this doesn't break the stitched case since we'll exit the loop
- startingLoc += stripLength + 1;
- }
-
- //next, the list
- if(tempFaces.size() != 0)
- {
- int faceGroupLoc = (*numGroups) - 1; //the face group is the last one
- primGroupArray[faceGroupLoc].type = PT_LIST;
- primGroupArray[faceGroupLoc].indices = new unsigned short[tempFaces.size() * 3];
- primGroupArray[faceGroupLoc].numIndices = tempFaces.size() * 3;
- int indexCtr = 0;
- for(size_t i = 0; i < tempFaces.size(); i++)
- {
- primGroupArray[faceGroupLoc].indices[indexCtr++] = tempFaces[i]->m_v0;
- primGroupArray[faceGroupLoc].indices[indexCtr++] = tempFaces[i]->m_v1;
- primGroupArray[faceGroupLoc].indices[indexCtr++] = tempFaces[i]->m_v2;
- }
- }
- }
-
- //validate generated data against input
- if (validateEnabled)
- {
- const int NUMBINS = 100;
-
- std::vector<NvFaceInfo> in_bins[NUMBINS];
-
- //hash input indices on first index
- for (size_t i = 0; i < in_numIndices; i += 3)
- {
- NvFaceInfo faceInfo(in_indices[i], in_indices[i + 1], in_indices[i + 2]);
- in_bins[in_indices[i] % NUMBINS].push_back(faceInfo);
- }
-
- for (int i = 0; i < *numGroups; ++i)
- {
- switch ((*primGroups)[i].type)
- {
- case PT_LIST:
- {
- for (size_t j = 0; j < (*primGroups)[i].numIndices; j += 3)
- {
- unsigned short v0 = (*primGroups)[i].indices[j];
- unsigned short v1 = (*primGroups)[i].indices[j + 1];
- unsigned short v2 = (*primGroups)[i].indices[j + 2];
-
- //ignore degenerates
- if (NvStripifier::IsDegenerate(v0, v1, v2))
- continue;
-
- if (!TestTriangle(v0, v1, v2, in_bins, NUMBINS))
- {
- Cleanup(tempStrips, tempFaces);
- return false;
- }
- }
- break;
- }
-
- case PT_STRIP:
- {
- //int brokenCtr = 0;
- bool flip = false;
- for (size_t j = 2; j < (*primGroups)[i].numIndices; ++j)
- {
- unsigned short v0 = (*primGroups)[i].indices[j - 2];
- unsigned short v1 = (*primGroups)[i].indices[j - 1];
- unsigned short v2 = (*primGroups)[i].indices[j];
-
- if (flip)
- {
- //swap v1 and v2
- unsigned short swap = v1;
- v1 = v2;
- v2 = swap;
- }
-
- //ignore degenerates
- if (NvStripifier::IsDegenerate(v0, v1, v2))
- {
- flip = !flip;
- continue;
- }
-
- if (!TestTriangle(v0, v1, v2, in_bins, NUMBINS))
- {
- Cleanup(tempStrips, tempFaces);
- return false;
- }
-
- flip = !flip;
- }
- break;
- }
-
- case PT_FAN:
- default:
- break;
- }
- }
-
- }
-
- //clean up everything
- Cleanup(tempStrips, tempFaces);
-
- return true;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-// RemapIndices()
-//
-// Function to remap your indices to improve spatial locality in your vertex buffer.
-//
-// in_primGroups: array of PrimitiveGroups you want remapped
-// numGroups: number of entries in in_primGroups
-// numVerts: number of vertices in your vertex buffer, also can be thought of as the range
-// of acceptable values for indices in your primitive groups.
-// remappedGroups: array of remapped PrimitiveGroups
-//
-// Note that, according to the remapping handed back to you, you must reorder your
-// vertex buffer.
-//
-void RemapIndices(const PrimitiveGroup* in_primGroups, const unsigned short numGroups,
- const unsigned short numVerts, PrimitiveGroup** remappedGroups)
-{
- (*remappedGroups) = new PrimitiveGroup[numGroups];
-
- //caches oldIndex --> newIndex conversion
- int *indexCache;
- indexCache = new int[numVerts];
- memset(indexCache, -1, sizeof(int)*numVerts);
-
- //loop over primitive groups
- unsigned int indexCtr = 0;
- for(int i = 0; i < numGroups; i++)
- {
- unsigned int numIndices = in_primGroups[i].numIndices;
-
- //init remapped group
- (*remappedGroups)[i].type = in_primGroups[i].type;
- (*remappedGroups)[i].numIndices = numIndices;
- (*remappedGroups)[i].indices = new unsigned short[numIndices];
-
- for(size_t j = 0; j < numIndices; j++)
- {
- int cachedIndex = indexCache[in_primGroups[i].indices[j]];
- if(cachedIndex == -1) //we haven't seen this index before
- {
- //point to "last" vertex in VB
- (*remappedGroups)[i].indices[j] = indexCtr;
-
- //add to index cache, increment
- indexCache[in_primGroups[i].indices[j]] = indexCtr++;
- }
- else
- {
- //we've seen this index before
- (*remappedGroups)[i].indices[j] = cachedIndex;
- }
- }
- }
-
- delete[] indexCache;
-}
+ size_t i;
+ for(i = startingLoc; i < stripIndices.size(); i++)
+ {
+ if(stripIndices[i] == -1)
+ break;
+ }
+
+ stripLength = i - startingLoc;
+ }
+ else
+ stripLength = stripIndices.size();
+
+ primGroupArray[stripCtr].type = PT_STRIP;
+ primGroupArray[stripCtr].indices = new unsigned short[stripLength];
+ primGroupArray[stripCtr].numIndices = stripLength;
+
+ int indexCtr = 0;
+ for(int i = startingLoc; i < stripLength + startingLoc; i++)
+ primGroupArray[stripCtr].indices[indexCtr++] = stripIndices[i];
+
+ //we add 1 to account for the -1 separating strips
+ //this doesn't break the stitched case since we'll exit the loop
+ startingLoc += stripLength + 1;
+ }
+
+ //next, the list
+ if(tempFaces.size() != 0)
+ {
+ int faceGroupLoc = (*numGroups) - 1; //the face group is the last one
+ primGroupArray[faceGroupLoc].type = PT_LIST;
+ primGroupArray[faceGroupLoc].indices = new unsigned short[tempFaces.size() * 3];
+ primGroupArray[faceGroupLoc].numIndices = tempFaces.size() * 3;
+ int indexCtr = 0;
+ for(size_t i = 0; i < tempFaces.size(); i++)
+ {
+ primGroupArray[faceGroupLoc].indices[indexCtr++] = tempFaces[i]->m_v0;
+ primGroupArray[faceGroupLoc].indices[indexCtr++] = tempFaces[i]->m_v1;
+ primGroupArray[faceGroupLoc].indices[indexCtr++] = tempFaces[i]->m_v2;
+ }
+ }
+ }
+
+ //validate generated data against input
+ if (validateEnabled)
+ {
+ const int NUMBINS = 100;
+
+ std::vector<NvFaceInfo> in_bins[NUMBINS];
+
+ //hash input indices on first index
+ for (size_t i = 0; i < in_numIndices; i += 3)
+ {
+ NvFaceInfo faceInfo(in_indices[i], in_indices[i + 1], in_indices[i + 2]);
+ in_bins[in_indices[i] % NUMBINS].push_back(faceInfo);
+ }
+
+ for (int i = 0; i < *numGroups; ++i)
+ {
+ switch ((*primGroups)[i].type)
+ {
+ case PT_LIST:
+ {
+ for (size_t j = 0; j < (*primGroups)[i].numIndices; j += 3)
+ {
+ unsigned short v0 = (*primGroups)[i].indices[j];
+ unsigned short v1 = (*primGroups)[i].indices[j + 1];
+ unsigned short v2 = (*primGroups)[i].indices[j + 2];
+
+ //ignore degenerates
+ if (NvStripifier::IsDegenerate(v0, v1, v2))
+ continue;
+
+ if (!TestTriangle(v0, v1, v2, in_bins, NUMBINS))
+ {
+ Cleanup(tempStrips, tempFaces);
+ return false;
+ }
+ }
+ break;
+ }
+
+ case PT_STRIP:
+ {
+ //int brokenCtr = 0;
+ bool flip = false;
+ for (size_t j = 2; j < (*primGroups)[i].numIndices; ++j)
+ {
+ unsigned short v0 = (*primGroups)[i].indices[j - 2];
+ unsigned short v1 = (*primGroups)[i].indices[j - 1];
+ unsigned short v2 = (*primGroups)[i].indices[j];
+
+ if (flip)
+ {
+ //swap v1 and v2
+ unsigned short swap = v1;
+ v1 = v2;
+ v2 = swap;
+ }
+
+ //ignore degenerates
+ if (NvStripifier::IsDegenerate(v0, v1, v2))
+ {
+ flip = !flip;
+ continue;
+ }
+
+ if (!TestTriangle(v0, v1, v2, in_bins, NUMBINS))
+ {
+ Cleanup(tempStrips, tempFaces);
+ return false;
+ }
+
+ flip = !flip;
+ }
+ break;
+ }
+
+ case PT_FAN:
+ default:
+ break;
+ }
+ }
+
+ }
+
+ //clean up everything
+ Cleanup(tempStrips, tempFaces);
+
+ return true;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////
+// RemapIndices()
+//
+// Function to remap your indices to improve spatial locality in your vertex buffer.
+//
+// in_primGroups: array of PrimitiveGroups you want remapped
+// numGroups: number of entries in in_primGroups
+// numVerts: number of vertices in your vertex buffer, also can be thought of as the range
+// of acceptable values for indices in your primitive groups.
+// remappedGroups: array of remapped PrimitiveGroups
+//
+// Note that, according to the remapping handed back to you, you must reorder your
+// vertex buffer.
+//
+void RemapIndices(const PrimitiveGroup* in_primGroups, const unsigned short numGroups,
+ const unsigned short numVerts, PrimitiveGroup** remappedGroups)
+{
+ (*remappedGroups) = new PrimitiveGroup[numGroups];
+
+ //caches oldIndex --> newIndex conversion
+ int *indexCache;
+ indexCache = new int[numVerts];
+ memset(indexCache, -1, sizeof(int)*numVerts);
+
+ //loop over primitive groups
+ unsigned int indexCtr = 0;
+ for(int i = 0; i < numGroups; i++)
+ {
+ unsigned int numIndices = in_primGroups[i].numIndices;
+
+ //init remapped group
+ (*remappedGroups)[i].type = in_primGroups[i].type;
+ (*remappedGroups)[i].numIndices = numIndices;
+ (*remappedGroups)[i].indices = new unsigned short[numIndices];
+
+ for(size_t j = 0; j < numIndices; j++)
+ {
+ int cachedIndex = indexCache[in_primGroups[i].indices[j]];
+ if(cachedIndex == -1) //we haven't seen this index before
+ {
+ //point to "last" vertex in VB
+ (*remappedGroups)[i].indices[j] = indexCtr;
+
+ //add to index cache, increment
+ indexCache[in_primGroups[i].indices[j]] = indexCtr++;
+ }
+ else
+ {
+ //we've seen this index before
+ (*remappedGroups)[i].indices[j] = cachedIndex;
+ }
+ }
+ }
+
+ delete[] indexCache;
+}
View
3,526 NvTriStrip/NvTriStripObjects.cpp
1,763 additions, 1,763 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
2 doxygen_makeapidocs.bat
@@ -1 +1 @@
-"C:\Program Files (x86)\doxygen\bin\doxygen.exe"
+"C:\Program Files (x86)\doxygen\bin\doxygen.exe"
View
2 doxygen_makeqttag.bat
@@ -1 +1 @@
-"C:\Program Files (x86)\doxygen\bin\doxytag.exe" -t qt.tag C:\Qt\4.5.0\doc\html
+"C:\Program Files (x86)\doxygen\bin\doxytag.exe" -t qt.tag C:\Qt\4.5.0\doc\html
View
26 fsengine/bsatest.pro
@@ -1,13 +1,13 @@
-TEMPLATE = app
-LANGUAGE = C++
-TARGET = bsatest
-
-DEFINES += BSA_TEST
-
-CONFIG += qt release thread warn_on console
-LIBS += -lmingw32 -lqtmain
-
-DESTDIR = ./
-
-HEADERS += *.h
-SOURCES += *.cpp
+TEMPLATE = app
+LANGUAGE = C++
+TARGET = bsatest
+
+DEFINES += BSA_TEST
+
+CONFIG += qt release thread warn_on console
+LIBS += -lmingw32 -lqtmain
+
+DESTDIR = ./
+
+HEADERS += *.h
+SOURCES += *.cpp
View
2 icon.rc
@@ -1 +1 @@
-IDI_ICON1 ICON DISCARDABLE "icon.ico"
+IDI_ICON1 ICON DISCARDABLE "icon.ico"
View
8 makeconfig.bat
@@ -1,5 +1,5 @@
-rem Quick script to create config.h
-
-"%PROGRAMFILES%\TortoiseSVN\bin\SubWCRev.exe" . config.h.in config.h
-
+rem Quick script to create config.h
+
+"%PROGRAMFILES%\TortoiseSVN\bin\SubWCRev.exe" . config.h.in config.h
+
pause
View
54 nifskope.qrc
@@ -1,27 +1,27 @@
-<!DOCTYPE RCC>
-<RCC version="1.0">
- <qresource prefix="/res">
- <file>nifskope.png</file>
- <file>spells/skel.dat</file>
- </qresource>
- <qresource prefix="/img">
- <file alias="ArrowLeft.png">resources/arrow_left.png</file>
- <file alias="ArrowRight.png">resources/arrow_right.png</file>
- <file alias="update">resources/img_update.png</file>
- <file alias="link">resources/img_link.png</file>
- <file alias="flag">resources/img_flag.png</file>
- <file alias="havok_logo">resources/havok_logo.png</file>
- </qresource>
- <qresource prefix="/btn">
- <file alias="play">resources/button_play.png</file>
- <file alias="loop">resources/button_loop.png</file>
- <file alias="switch">resources/button_switch.png</file>
- <file alias="viewTop">resources/button_view_top.png</file>
- <file alias="viewFront">resources/button_view_front.png</file>
- <file alias="viewSide">resources/button_view_side.png</file>
- <file alias="viewWalk">resources/button_view_walk.png</file>
- <file alias="viewUser">resources/button_view_user.png</file>
- <file alias="viewFlip">resources/button_view_flip.png</file>
- <file alias="viewPers">resources/button_view_pers.png</file>
- </qresource>
-</RCC>
+<!DOCTYPE RCC>
+<RCC version="1.0">
+ <qresource prefix="/res">
+ <file>nifskope.png</file>
+ <file>spells/skel.dat</file>
+ </qresource>
+ <qresource prefix="/img">
+ <file alias="ArrowLeft.png">resources/arrow_left.png</file>
+ <file alias="ArrowRight.png">resources/arrow_right.png</file>
+ <file alias="update">resources/img_update.png</file>
+ <file alias="link">resources/img_link.png</file>
+ <file alias="flag">resources/img_flag.png</file>
+ <file alias="havok_logo">resources/havok_logo.png</file>
+ </qresource>
+ <qresource prefix="/btn">
+ <file alias="play">resources/button_play.png</file>
+ <file alias="loop">resources/button_loop.png</file>
+ <file alias="switch">resources/button_switch.png</file>
+ <file alias="viewTop">resources/button_view_top.png</file>
+ <file alias="viewFront">resources/button_view_front.png</file>
+ <file alias="viewSide">resources/button_view_side.png</file>
+ <file alias="viewWalk">resources/button_view_walk.png</file>
+ <file alias="viewUser">resources/button_view_user.png</file>
+ <file alias="viewFlip">resources/button_view_flip.png</file>
+ <file alias="viewPers">resources/button_view_pers.png</file>
+ </qresource>
+</RCC>
View
66 shaders/ob_glowmap.vert
@@ -1,33 +1,33 @@
-
-varying vec3 LightDir;
-varying vec3 ViewDir;
-varying vec3 HalfVector;
-
-varying vec4 ColorEA;
-varying vec4 ColorD;
-
-vec3 normal;
-vec3 tangent;
-vec3 binormal;
-
-vec3 tspace( vec3 v )
-{
- return vec3( dot( v, binormal ), dot( v, tangent ), dot( v, normal ) );
-}
-
-void main( void )
-{
- gl_Position = ftransform();
- gl_TexCoord[0] = gl_MultiTexCoord0;
-
- normal = gl_NormalMatrix * gl_Normal;
- tangent = gl_NormalMatrix * gl_MultiTexCoord1.xyz;
- binormal = gl_NormalMatrix * gl_MultiTexCoord2.xyz;
-
- ViewDir = tspace( ( gl_ModelViewMatrix * gl_Vertex ).xyz );
- LightDir = tspace( gl_LightSource[0].position.xyz ); // light 0 is directional
- HalfVector = tspace( gl_LightSource[0].halfVector.xyz );
-
- ColorEA = gl_FrontMaterial.ambient * gl_LightSource[0].ambient;
- ColorD = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse;
-}
+
+varying vec3 LightDir;
+varying vec3 ViewDir;
+varying vec3 HalfVector;
+
+varying vec4 ColorEA;
+varying vec4 ColorD;
+
+vec3 normal;
+vec3 tangent;
+vec3 binormal;
+
+vec3 tspace( vec3 v )
+{
+ return vec3( dot( v, binormal ), dot( v, tangent ), dot( v, normal ) );
+}
+
+void main( void )
+{
+ gl_Position = ftransform();
+ gl_TexCoord[0] = gl_MultiTexCoord0;
+
+ normal = gl_NormalMatrix * gl_Normal;
+ tangent = gl_NormalMatrix * gl_MultiTexCoord1.xyz;
+ binormal = gl_NormalMatrix * gl_MultiTexCoord2.xyz;
+
+ ViewDir = tspace( ( gl_ModelViewMatrix * gl_Vertex ).xyz );
+ LightDir = tspace( gl_LightSource[0].position.xyz ); // light 0 is directional
+ HalfVector = tspace( gl_LightSource[0].halfVector.xyz );
+
+ ColorEA = gl_FrontMaterial.ambient * gl_LightSource[0].ambient;
+ ColorD = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse;
+}
View
66 shaders/ob_material_default.vert
@@ -1,33 +1,33 @@
-
-varying vec3 LightDir;
-varying vec3 ViewDir;
-varying vec3 HalfVector;
-
-varying vec4 ColorEA;
-varying vec4 ColorD;
-
-vec3 normal;
-vec3 tangent;
-vec3 binormal;
-
-vec3 tspace( vec3 v )
-{
- return vec3( dot( v, binormal ), dot( v, tangent ), dot( v, normal ) );
-}
-
-void main( void )
-{
- gl_Position = ftransform();
- gl_TexCoord[0] = gl_MultiTexCoord0;
-
- normal = gl_NormalMatrix * gl_Normal;
- tangent = gl_NormalMatrix * gl_MultiTexCoord1.xyz;
- binormal = gl_NormalMatrix * gl_MultiTexCoord2.xyz;
-
- ViewDir = tspace( ( gl_ModelViewMatrix * gl_Vertex ).xyz );
- LightDir = tspace( gl_LightSource[0].position.xyz ); // light 0 is directional
- HalfVector = tspace( gl_LightSource[0].halfVector.xyz );
-
- ColorEA = gl_FrontMaterial.emission + gl_FrontMaterial.ambient * gl_LightSource[0].ambient;
- ColorD = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse;
-}
+
+varying vec3 LightDir;
+varying vec3 ViewDir;
+varying vec3 HalfVector;
+
+varying vec4 ColorEA;
+varying vec4 ColorD;
+
+vec3 normal;
+vec3 tangent;
+vec3 binormal;
+
+vec3 tspace( vec3 v )
+{
+ return vec3( dot( v, binormal ), dot( v, tangent ), dot( v, normal ) );
+}
+
+void main( void )
+{
+ gl_Position = ftransform();
+ gl_TexCoord[0] = gl_MultiTexCoord0;
+
+ normal = gl_NormalMatrix * gl_Normal;
+ tangent = gl_NormalMatrix * gl_MultiTexCoord1.xyz;
+ binormal = gl_NormalMatrix * gl_MultiTexCoord2.xyz;
+
+ ViewDir = tspace( ( gl_ModelViewMatrix * gl_Vertex ).xyz );
+ LightDir = tspace( gl_LightSource[0].position.xyz ); // light 0 is directional
+ HalfVector = tspace( gl_LightSource[0].halfVector.xyz );
+
+ ColorEA = gl_FrontMaterial.emission + gl_FrontMaterial.ambient * gl_LightSource[0].ambient;
+ ColorD = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse;
+}
View
22 shaders/ob_normal+glowmap.prog
@@ -1,11 +1,11 @@
-
-comment normal + glow mapping, vertex colors -> ignore, material emissive color -> ignore
-
-check NiTexturingProperty/Apply Mode == 2
-check NiTriBasedGeom/Has Shader == 0
-
-texcoords 0 base
-texcoords 1 tangents
-texcoords 2 binormals
-
-shaders ob_glowmap.vert ob_normalglowmap.frag
+
+comment normal + glow mapping, vertex colors -> ignore, material emissive color -> ignore
+
+check NiTexturingProperty/Apply Mode == 2
+check NiTriBasedGeom/Has Shader == 0
+
+texcoords 0 base
+texcoords 1 tangents
+texcoords 2 binormals
+
+shaders ob_glowmap.vert ob_normalglowmap.frag
View
68 shaders/ob_normalglowmap.frag
@@ -1,34 +1,34 @@
-uniform sampler2D BaseMap;
-uniform sampler2D NormalMap;
-uniform sampler2D GlowMap;
-
-varying vec3 LightDir;
-varying vec3 HalfVector;
-//varying vec3 ViewDir;
-
-varying vec4 ColorEA;
-varying vec4 ColorD;
-
-void main( void )
-{
- vec4 color = ColorEA;
-
- color += texture2D( GlowMap, gl_TexCoord[0].st );
-
- vec4 normal = texture2D( NormalMap, gl_TexCoord[0].st );
- normal.rgb = normal.rgb * 2.0 - 1.0;
-
- float NdotL = max( dot( normal.rgb, normalize( LightDir ) ), 0.0 );
-
- if ( NdotL > 0.0 )
- {
- color += ColorD * NdotL;
- float NdotHV = max( dot( normal.rgb, normalize( HalfVector ) ), 0.0 );
- color += normal.a * gl_FrontMaterial.specular * gl_LightSource[0].specular * pow( NdotHV, gl_FrontMaterial.shininess );
- }
-
- color = min( color, 1.0 );
- color *= texture2D( BaseMap, gl_TexCoord[0].st );
-
- gl_FragColor = color;
-}
+uniform sampler2D BaseMap;
+uniform sampler2D NormalMap;
+uniform sampler2D GlowMap;
+
+varying vec3 LightDir;
+varying vec3 HalfVector;
+//varying vec3 ViewDir;
+
+varying vec4 ColorEA;
+varying vec4 ColorD;
+
+void main( void )
+{
+ vec4 color = ColorEA;
+
+ color += texture2D( GlowMap, gl_TexCoord[0].st );
+
+ vec4 normal = texture2D( NormalMap, gl_TexCoord[0].st );
+ normal.rgb = normal.rgb * 2.0 - 1.0;
+
+ float NdotL = max( dot( normal.rgb, normalize( LightDir ) ), 0.0 );
+
+ if ( NdotL > 0.0 )
+ {
+ color += ColorD * NdotL;
+ float NdotHV = max( dot( normal.rgb, normalize( HalfVector ) ), 0.0 );
+ color += normal.a * gl_FrontMaterial.specular * gl_LightSource[0].specular * pow( NdotHV, gl_FrontMaterial.shininess );
+ }
+
+ color = min( color, 1.0 );
+ color *= texture2D( BaseMap, gl_TexCoord[0].st );
+
+ gl_FragColor = color;
+}
View
62 shaders/ob_normalmap.frag
@@ -1,31 +1,31 @@
-uniform sampler2D BaseMap;
-uniform sampler2D NormalMap;
-
-varying vec3 LightDir;
-varying vec3 HalfVector;
-//varying vec3 ViewDir;
-
-varying vec4 ColorEA;
-varying vec4 ColorD;
-
-void main( void )
-{
- vec4 color = ColorEA;
-
- vec4 normal = texture2D( NormalMap, gl_TexCoord[0].st );
- normal.rgb = normal.rgb * 2.0 - 1.0;
-
- float NdotL = max( dot( normal.rgb, normalize( LightDir ) ), 0.0 );
-
- if ( NdotL > 0.0 )
- {
- color += ColorD * NdotL;
- float NdotHV = max( dot( normal.rgb, normalize( HalfVector ) ), 0.0 );
- color += normal.a * gl_FrontMaterial.specular * gl_LightSource[0].specular * pow( NdotHV, gl_FrontMaterial.shininess );
- }
-
- color = min( color, 1.0 );
- color *= texture2D( BaseMap, gl_TexCoord[0].st );
-
- gl_FragColor = color;
-}
+uniform sampler2D BaseMap;
+uniform sampler2D NormalMap;
+
+varying vec3 LightDir;
+varying vec3 HalfVector;
+//varying vec3 ViewDir;
+
+varying vec4 ColorEA;
+varying vec4 ColorD;
+
+void main( void )
+{
+ vec4 color = ColorEA;
+
+ vec4 normal = texture2D( NormalMap, gl_TexCoord[0].st );
+ normal.rgb = normal.rgb * 2.0 - 1.0;
+
+ float NdotL = max( dot( normal.rgb, normalize( LightDir ) ), 0.0 );
+
+ if ( NdotL > 0.0 )
+ {
+ color += ColorD * NdotL;
+ float NdotHV = max( dot( normal.rgb, normalize( HalfVector ) ), 0.0 );
+ color += normal.a * gl_FrontMaterial.specular * gl_LightSource[0].specular * pow( NdotHV, gl_FrontMaterial.shininess );
+ }
+
+ color = min( color, 1.0 );
+ color *= texture2D( BaseMap, gl_TexCoord[0].st );
+
+ gl_FragColor = color;
+}
View
54 shaders/ob_normalmap.prog
@@ -1,27 +1,27 @@
-
-comment normal mapping, no vertex colors
-
-checkgroup begin or
- checkgroup begin and
- check HEADER/Version >= 0x14020007
- check HEADER/User Version >= 11
- checkgroup end
- checkgroup begin
- check NiTexturingProperty/Apply Mode == 2
- check NiTriBasedGeom/Has Shader == 0
- checkgroup end
-checkgroup end
-
-checkgroup begin or
- check NiTriBasedGeomData/Has Vertex Colors == 0
- checkgroup begin
- check NiVertexColorProperty/Vertex Mode == 0
- check NiVertexColorProperty/Lighting Mode == 1
- checkgroup end
-checkgroup end
-
-texcoords 0 base
-texcoords 1 tangents
-texcoords 2 binormals
-
-shaders ob_material_default.vert ob_normalmap.frag
+
+comment normal mapping, no vertex colors
+
+checkgroup begin or
+ checkgroup begin and
+ check HEADER/Version >= 0x14020007
+ check HEADER/User Version >= 11
+ checkgroup end
+ checkgroup begin
+ check NiTexturingProperty/Apply Mode == 2
+ check NiTriBasedGeom/Has Shader == 0
+ checkgroup end
+checkgroup end
+
+checkgroup begin or
+ check NiTriBasedGeomData/Has Vertex Colors == 0
+ checkgroup begin
+ check NiVertexColorProperty/Vertex Mode == 0
+ check NiVertexColorProperty/Lighting Mode == 1
+ checkgroup end
+checkgroup end
+
+texcoords 0 base
+texcoords 1 tangents
+texcoords 2 binormals
+
+shaders ob_material_default.vert ob_normalmap.frag
View
42 shaders/ob_normalmap_vcol_ad.prog
@@ -1,21 +1,21 @@
-
-comment normal mapping, vertex colors -> ambient&diffuse
-
-check NiTexturingProperty/Apply Mode == 2
-check NiTriBasedGeom/Has Shader == 0
-
-check NiTriBasedGeomData/Has Vertex Colors != 0
-
-checkgroup begin or
- check not NiVertexColorProperty
- checkgroup begin
- check NiVertexColorProperty/Vertex Mode == 2
- check NiVertexColorProperty/Lighting Mode == 1
- checkgroup end
-checkgroup end
-
-texcoords 0 base
-texcoords 1 tangents
-texcoords 2 binormals
-
-shaders ob_vcolors_ad.vert ob_normalmap.frag
+
+comment normal mapping, vertex colors -> ambient&diffuse
+
+check NiTexturingProperty/Apply Mode == 2
+check NiTriBasedGeom/Has Shader == 0
+
+check NiTriBasedGeomData/Has Vertex Colors != 0
+
+checkgroup begin or
+ check not NiVertexColorProperty
+ checkgroup begin
+ check NiVertexColorProperty/Vertex Mode == 2
+ check NiVertexColorProperty/Lighting Mode == 1
+ checkgroup end
+checkgroup end
+
+texcoords 0 base
+texcoords 1 tangents
+texcoords 2 binormals
+
+shaders ob_vcolors_ad.vert ob_normalmap.frag
View
34 shaders/ob_normalmap_vcol_e.prog
@@ -1,17 +1,17 @@
-
-comment normal mapping, vertex colors -> emissive
-
-check NiTexturingProperty/Apply Mode == 2
-check NiTriBasedGeom/Has Shader == 0
-
-checkgroup begin
- check NiTriBasedGeomData/Has Vertex Colors != 0
- check NiVertexColorProperty/Vertex Mode == 1
- check NiVertexColorProperty/Lighting Mode == 1
-checkgroup end
-
-texcoords 0 base
-texcoords 1 tangents
-texcoords 2 binormals
-
-shaders ob_vcolors_e.vert ob_normalmap.frag
+
+comment normal mapping, vertex colors -> emissive
+
+check NiTexturingProperty/Apply Mode == 2
+check NiTriBasedGeom/Has Shader == 0
+
+checkgroup begin
+ check NiTriBasedGeomData/Has Vertex Colors != 0
+ check NiVertexColorProperty/Vertex Mode == 1
+ check NiVertexColorProperty/Lighting Mode == 1
+checkgroup end
+
+texcoords 0 base
+texcoords 1 tangents
+texcoords 2 binormals
+
+shaders ob_vcolors_e.vert ob_normalmap.frag
View
22 shaders/ob_parallax+glowmap.prog
@@ -1,11 +1,11 @@
-
-comment normal + glow mapping, vertex colors -> ignore, material emissive color -> ignore
-
-check NiTexturingProperty/Apply Mode == 4
-check NiTriBasedGeom/Has Shader == 0
-
-texcoords 0 base
-texcoords 1 tangents
-texcoords 2 binormals
-
-shaders ob_glowmap.vert ob_parallaxglowmap.frag
+
+comment normal + glow mapping, vertex colors -> ignore, material emissive color -> ignore
+
+check NiTexturingProperty/Apply Mode == 4
+check NiTriBasedGeom/Has Shader == 0
+
+texcoords 0 base
+texcoords 1 tangents
+texcoords 2 binormals
+
+shaders ob_glowmap.vert ob_parallaxglowmap.frag
View
68 shaders/ob_parallax.frag
@@ -1,34 +1,34 @@
-uniform sampler2D BaseMap;
-uniform sampler2D NormalMap;
-
-varying vec3 LightDir;
-varying vec3 HalfVector;
-varying vec3 ViewDir;
-
-varying vec4 ColorEA;
-varying vec4 ColorD;
-
-void main( void )
-{
- float offset = 0.015 - texture2D( BaseMap, gl_TexCoord[0].st ).a * 0.03;
- vec2 texco = gl_TexCoord[0].st + normalize( ViewDir ).xy * offset;
-
- vec4 color = ColorEA;
-
- vec4 normal = texture2D( NormalMap, texco );
- normal.rgb = normal.rgb * 2.0 - 1.0;
-
- float NdotL = max( dot( normal.rgb, normalize( LightDir ) ), 0.0 );
-
- if ( NdotL > 0.0 )
- {
- color += ColorD * NdotL;
- float NdotHV = max( dot( normal.rgb, normalize( HalfVector ) ), 0.0 );
- color += normal.a * gl_FrontMaterial.specular * gl_LightSource[0].specular * pow( NdotHV, gl_FrontMaterial.shininess );
- }
-
- color = min( color, 1.0 );
- color *= texture2D( BaseMap, texco );
-
- gl_FragColor = color;
-}
+uniform sampler2D BaseMap;
+uniform sampler2D NormalMap;
+
+varying vec3 LightDir;
+varying vec3 HalfVector;
+varying vec3 ViewDir;
+
+varying vec4 ColorEA;
+varying vec4 ColorD;
+
+void main( void )
+{
+ float offset = 0.015 - texture2D( BaseMap, gl_TexCoord[0].st ).a * 0.03;
+ vec2 texco = gl_TexCoord[0].st + normalize( ViewDir ).xy * offset;
+
+ vec4 color = ColorEA;
+
+ vec4 normal = texture2D( NormalMap, texco );
+ normal.rgb = normal.rgb * 2.0 - 1.0;
+
+ float NdotL = max( dot( normal.rgb, normalize( LightDir ) ), 0.0 );
+
+ if ( NdotL > 0.0 )
+ {
+ color += ColorD * NdotL;
+ float NdotHV = max( dot( normal.rgb, normalize( HalfVector ) ), 0.0 );
+ color += normal.a * gl_FrontMaterial.specular * gl_LightSource[0].specular * pow( NdotHV, gl_FrontMaterial.shininess );
+ }
+
+ color = min( color, 1.0 );
+ color *= texture2D( BaseMap, texco );
+
+ gl_FragColor = color;
+}
View
38 shaders/ob_parallax.prog
@@ -1,19 +1,19 @@
-
-comment normal+parallax mapping, no vertex colors
-
-check NiTexturingProperty/Apply Mode == 4
-check NiTriBasedGeom/Has Shader == 0
-
-checkgroup begin or
- check NiTriBasedGeomData/Has Vertex Colors == 0
- checkgroup begin
- check NiVertexColorProperty/Vertex Mode == 0
- check NiVertexColorProperty/Lighting Mode == 1
- checkgroup end
-checkgroup end
-
-texcoords 0 base
-texcoords 1 tangents
-texcoords 2 binormals
-
-shaders ob_material_default.vert ob_parallax.frag
+
+comment normal+parallax mapping, no vertex colors
+
+check NiTexturingProperty/Apply Mode == 4
+check NiTriBasedGeom/Has Shader == 0
+
+checkgroup begin or
+ check NiTriBasedGeomData/Has Vertex Colors == 0
+ checkgroup begin
+ check NiVertexColorProperty/Vertex Mode == 0
+ check NiVertexColorProperty/Lighting Mode == 1
+ checkgroup end
+checkgroup end
+
+texcoords 0 base
+texcoords 1 tangents
+texcoords 2 binormals
+
+shaders ob_material_default.vert ob_parallax.frag
View
42 shaders/ob_parallax_vcol_ad.prog
@@ -1,21 +1,21 @@
-
-comment normal+parallax mapping, vertex colors -> ambient&diffuse
-
-check NiTexturingProperty/Apply Mode == 4
-check NiTriBasedGeom/Has Shader == 0
-
-check NiTriBasedGeomData/Has Vertex Colors != 0
-
-checkgroup begin or
- check not NiVertexColorProperty
- checkgroup begin
- check NiVertexColorProperty/Vertex Mode == 2
- check NiVertexColorProperty/Lighting Mode == 1
- checkgroup end
-checkgroup end
-
-texcoords 0 base
-texcoords 1 tangents
-texcoords 2 binormals
-
-shaders ob_vcolors_ad.vert ob_parallax.frag
+
+comment normal+parallax mapping, vertex colors -> ambient&diffuse
+
+check NiTexturingProperty/Apply Mode == 4
+check NiTriBasedGeom/Has Shader == 0
+
+check NiTriBasedGeomData/Has Vertex Colors != 0
+
+checkgroup begin or
+ check not NiVertexColorProperty
+ checkgroup begin
+ check NiVertexColorProperty/Vertex Mode == 2
+ check NiVertexColorProperty/Lighting Mode == 1
+ checkgroup end
+checkgroup end
+
+texcoords 0 base
+texcoords 1 tangents
+texcoords 2 binormals
+
+shaders ob_vcolors_ad.vert ob_parallax.frag
View
34 shaders/ob_parallax_vcol_e.prog
@@ -1,17 +1,17 @@
-
-comment normal+parallax mapping, vertex colors -> emissive
-
-check NiTexturingProperty/Apply Mode == 4
-check NiTriBasedGeom/Has Shader == 0
-
-checkgroup begin
- check NiTriBasedGeomData/Has Vertex Colors != 0
- check NiVertexColorProperty/Vertex Mode == 1
- check NiVertexColorProperty/Lighting Mode == 1
-checkgroup end
-
-texcoords 0 base
-texcoords 1 tangents
-texcoords 2 binormals
-
-shaders ob_vcolors_e.vert ob_parallax.frag
+
+comment normal+parallax mapping, vertex colors -> emissive
+
+check NiTexturingProperty/Apply Mode == 4
+check NiTriBasedGeom/Has Shader == 0
+
+checkgroup begin
+ check NiTriBasedGeomData/Has Vertex Colors != 0
+ check NiVertexColorProperty/Vertex Mode == 1
+ check NiVertexColorProperty/Lighting Mode == 1
+checkgroup end
+
+texcoords 0 base
+texcoords 1 tangents
+texcoords 2 binormals
+
+shaders ob_vcolors_e.vert ob_parallax.frag
View
72 shaders/ob_parallaxglowmap.frag
@@ -1,36 +1,36 @@
-uniform sampler2D BaseMap;
-uniform sampler2D NormalMap;
-uniform sampler2D GlowMap;
-
-varying vec3 LightDir;
-varying vec3 HalfVector;
-varying vec3 ViewDir;
-
-varying vec4 ColorEA;
-varying vec4 ColorD;
-
-void main( void )
-{
- float offset = 0.015 - texture2D( BaseMap, gl_TexCoord[0].st ).a * 0.03;
- vec2 texco = gl_TexCoord[0].st + normalize( ViewDir ).xy * offset;
-
- vec4 color = ColorEA;
- color += texture2D( GlowMap, texco );
-
- vec4 normal = texture2D( NormalMap, texco );
- normal.rgb = normal.rgb * 2.0 - 1.0;
-
- float NdotL = max( dot( normal.rgb, normalize( LightDir ) ), 0.0 );
-
- if ( NdotL > 0.0 )
- {
- color += ColorD * NdotL;
- float NdotHV = max( dot( normal.rgb, normalize( HalfVector ) ), 0.0 );
- color += normal.a * gl_FrontMaterial.specular * gl_LightSource[0].specular * pow( NdotHV, gl_FrontMaterial.shininess );
- }
-
- color = min( color, 1.0 );
- color *= texture2D( BaseMap, texco );
-
- gl_FragColor = color;
-}
+uniform sampler2D BaseMap;
+uniform sampler2D NormalMap;
+uniform sampler2D GlowMap;
+
+varying vec3 LightDir;
+varying vec3 HalfVector;
+varying vec3 ViewDir;
+
+varying vec4 ColorEA;
+varying vec4 ColorD;
+
+void main( void )
+{
+ float offset = 0.015 - texture2D( BaseMap, gl_TexCoord[0].st ).a * 0.03;
+ vec2 texco = gl_TexCoord[0].st + normalize( ViewDir ).xy * offset;
+
+ vec4 color = ColorEA;
+ color += texture2D( GlowMap, texco );
+
+ vec4 normal = texture2D( NormalMap, texco );
+ normal.rgb = normal.rgb * 2.0 - 1.0;
+
+ float NdotL = max( dot( normal.rgb, normalize( LightDir ) ), 0.0 );
+
+ if ( NdotL > 0.0 )
+ {
+ color += ColorD * NdotL;
+ float NdotHV = max( dot( normal.rgb, normalize( HalfVector ) ), 0.0 );
+ color += normal.a * gl_FrontMaterial.specular * gl_LightSource[0].specular * pow( NdotHV, gl_FrontMaterial.shininess );
+ }
+
+ color = min( color, 1.0 );
+ color *= texture2D( BaseMap, texco );
+
+ gl_FragColor = color;
+}
View
66 shaders/ob_vcolors_ad.vert
@@ -1,33 +1,33 @@
-
-varying vec3 LightDir;
-varying vec3 ViewDir;
-varying vec3 HalfVector;
-
-varying vec4 ColorEA;
-varying vec4 ColorD;
-
-vec3 normal;
-vec3 tangent;
-vec3 binormal;
-
-vec3 tspace( vec3 v )
-{
- return vec3( dot( v, binormal ), dot( v, tangent ), dot( v, normal ) );
-}
-
-void main( void )
-{
- gl_Position = ftransform();
- gl_TexCoord[0] = gl_MultiTexCoord0;
-
- normal = gl_NormalMatrix * gl_Normal;
- tangent = gl_NormalMatrix * gl_MultiTexCoord1.xyz;
- binormal = gl_NormalMatrix * gl_MultiTexCoord2.xyz;
-
- ViewDir = tspace( ( gl_ModelViewMatrix * gl_Vertex ).xyz );
- LightDir = tspace( gl_LightSource[0].position.xyz ); // light 0 is directional
- HalfVector = tspace( gl_LightSource[0].halfVector.xyz );
-
- ColorEA = gl_FrontMaterial.emission + gl_Color * gl_LightSource[0].ambient;
- ColorD = gl_Color * gl_LightSource[0].diffuse;
-}
+
+varying vec3 LightDir;
+varying vec3 ViewDir;
+varying vec3 HalfVector;
+
+varying vec4 ColorEA;
+varying vec4 ColorD;
+
+vec3 normal;
+vec3 tangent;
+vec3 binormal;
+
+vec3 tspace( vec3 v )
+{
+ return vec3( dot( v, binormal ), dot( v, tangent ), dot( v, normal ) );
+}
+
+void main( void )
+{
+ gl_Position = ftransform();
+ gl_TexCoord[0] = gl_MultiTexCoord0;
+
+ normal = gl_NormalMatrix * gl_Normal;
+ tangent = gl_NormalMatrix * gl_MultiTexCoord1.xyz;
+ binormal = gl_NormalMatrix * gl_MultiTexCoord2.xyz;
+
+ ViewDir = tspace( ( gl_ModelViewMatrix * gl_Vertex ).xyz );
+ LightDir = tspace( gl_LightSource[0].position.xyz ); // light 0 is directional
+ HalfVector = tspace( gl_LightSource[0].halfVector.xyz );
+
+ ColorEA = gl_FrontMaterial.emission + gl_Color * gl_LightSource[0].ambient;
+ ColorD = gl_Color * gl_LightSource[0].diffuse;
+}
View
66 shaders/ob_vcolors_e.vert
@@ -1,33 +1,33 @@
-
-varying vec3 LightDir;
-varying vec3 ViewDir;
-varying vec3 HalfVector;
-
-varying vec4 ColorEA;
-varying vec4 ColorD;
-
-vec3 normal;
-vec3 tangent;
-vec3 binormal;
-
-vec3 tspace( vec3 v )
-{
- return vec3( dot( v, binormal ), dot( v, tangent ), dot( v, normal ) );
-}
-
-void main( void )
-{
- gl_Position = ftransform();
- gl_TexCoord[0] = gl_MultiTexCoord0;
-
- normal = gl_NormalMatrix * gl_Normal;
- tangent = gl_NormalMatrix * gl_MultiTexCoord1.xyz;
- binormal = gl_NormalMatrix * gl_MultiTexCoord2.xyz;
-
- ViewDir = tspace( ( gl_ModelViewMatrix * gl_Vertex ).xyz );
- LightDir = tspace( gl_LightSource[0].position.xyz ); // light 0 is directional
- HalfVector = tspace( gl_LightSource[0].halfVector.xyz );
-
- ColorEA = gl_Color + gl_FrontMaterial.ambient * gl_LightSource[0].ambient;
- ColorD = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse;
-}
+
+varying vec3 LightDir;
+varying vec3 ViewDir;
+varying vec3 HalfVector;
+
+varying vec4 ColorEA;
+varying vec4 ColorD;
+
+vec3 normal;
+vec3 tangent;
+vec3 binormal;
+
+vec3 tspace( vec3 v )
+{
+ return vec3( dot( v, binormal ), dot( v, tangent ), dot( v, normal ) );
+}
+
+void main( void )
+{
+ gl_Position = ftransform();
+ gl_TexCoord[0] = gl_MultiTexCoord0;
+
+ normal = gl_NormalMatrix * gl_Normal;
+ tangent = gl_NormalMatrix * gl_MultiTexCoord1.xyz;
+ binormal = gl_NormalMatrix * gl_MultiTexCoord2.xyz;
+
+ ViewDir = tspace( ( gl_ModelViewMatrix * gl_Vertex ).xyz );
+ LightDir = tspace( gl_LightSource[0].position.xyz ); // light 0 is directional
+ HalfVector = tspace( gl_LightSource[0].halfVector.xyz );
+
+ ColorEA = gl_Color + gl_FrontMaterial.ambient * gl_LightSource[0].ambient;
+ ColorD = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse;
+}
View
124 style.qss
@@ -1,62 +1,62 @@
-/*
- Stylish tooltips
-*/
-
-QToolTip
-{
- opacity: 223;
- color: steelblue;
- border: 1px solid steelblue;
- border-radius: 5px;
- padding: 4px;
- background: ghostwhite;
-}
-
-/*
- Make the disabled rows of the table views more distinguishable
-*/
-
-QTreeView
-{
- background: white;
- alternate-background-color: #F1F5FA;
- selection-background-color: #3D80DF;
- selection-color: white;
- color: black;
-}
-
-QTreeView:disabled
-{
- background: #C0C0C0;
- alternate-background-color: #C0C0C0;
- color: #7D7D7D;
-}
-
-
-/*
- Give the fileselectors a green tint on success and a red one on error
-*/
-
-FileSelector[state="0"] > QLineEdit
-{
- background-color: auto;
-}
-
-FileSelector[state="1"] > QLineEdit
-{
- background-color: #cfc;
-}
-
-FileSelector[state="2"] > QLineEdit
-{
- background-color: #fcc;
-}
-
-
-/*
- Add a border to the FloatSliderEditBoxes
-*/
-FloatSliderEditBox
-{
- border: 1px solid black;
-}
+/*
+ Stylish tooltips
+*/
+
+QToolTip
+{
+ opacity: 223;
+ color: steelblue;
+ border: 1px solid steelblue;
+ border-radius: 5px;
+ padding: 4px;
+ background: ghostwhite;
+}
+
+/*
+ Make the disabled rows of the table views more distinguishable
+*/
+
+QTreeView
+{
+ background: white;
+ alternate-background-color: #F1F5FA;
+ selection-background-color: #3D80DF;
+ selection-color: white;
+ color: black;
+}
+
+QTreeView:disabled
+{
+ background: #C0C0C0;
+ alternate-background-color: #C0C0C0;
+ color: #7D7D7D;
+}
+
+
+/*
+ Give the fileselectors a green tint on success and a red one on error
+*/
+
+FileSelector[state="0"] > QLineEdit
+{
+ background-color: auto;
+}
+
+FileSelector[state="1"] > QLineEdit
+{
+ background-color: #cfc;
+}
+
+FileSelector[state="2"] > QLineEdit
+{
+ background-color: #fcc;
+}
+
+
+/*
+ Add a border to the FloatSliderEditBoxes
+*/
+FloatSliderEditBox
+{
+ border: 1px solid black;
+}

0 comments on commit b986174

Please sign in to comment.
Something went wrong with that request. Please try again.