mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-11-27 22:10:06 +00:00
fix glBatchViewer
This commit is contained in:
parent
23ba172397
commit
5e5fc97b0c
@ -57,7 +57,7 @@
|
||||
|
||||
if( OPENGL_FOUND AND (GLEW_FOUND AND GLFW_FOUND) OR (APPLE AND GLFW_FOUND))
|
||||
add_subdirectory(glViewer)
|
||||
# add_subdirectory(glBatchViewer)
|
||||
add_subdirectory(glBatchViewer)
|
||||
add_subdirectory(simpleCpu)
|
||||
# add_subdirectory(evalTest)
|
||||
# add_subdirectory(limitEval)
|
||||
|
@ -100,6 +100,9 @@ endforeach()
|
||||
|
||||
_add_glfw_executable(glBatchViewer
|
||||
viewer.cpp
|
||||
delegate.cpp
|
||||
effect.cpp
|
||||
effectRegistry.cpp
|
||||
../common/font_image.cpp
|
||||
../common/hud.cpp
|
||||
../common/gl_hud.cpp
|
||||
|
169
examples/glBatchViewer/delegate.cpp
Normal file
169
examples/glBatchViewer/delegate.cpp
Normal file
@ -0,0 +1,169 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#if defined(__APPLE__)
|
||||
#include "TargetConditionals.h"
|
||||
#if TARGET_OS_IPHONE or TARGET_IPHONE_SIMULATOR
|
||||
#include <OpenGLES/ES2/gl.h>
|
||||
#else
|
||||
#include <OpenGL/gl3.h>
|
||||
#endif
|
||||
#elif defined(ANDROID)
|
||||
#include <GLES2/gl2.h>
|
||||
#else
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <GL/glew.h>
|
||||
#endif
|
||||
|
||||
#include "delegate.h"
|
||||
|
||||
MyDrawContext::MyDrawContext() {
|
||||
glGenVertexArrays(1, &vao);
|
||||
}
|
||||
|
||||
MyDrawContext::~MyDrawContext() {
|
||||
glDeleteVertexArrays(1, &vao);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void
|
||||
MyDrawDelegate::BindBatch(OpenSubdiv::OsdUtilMeshBatchBase<MyDrawContext> *batch) {
|
||||
|
||||
MyDrawContext *drawContext = batch->GetDrawContext();
|
||||
|
||||
// bind vao
|
||||
glBindVertexArray(drawContext->vao);
|
||||
|
||||
// bind vbo state
|
||||
// glBindVertexArray(batch->vao);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, batch->BindVertexBuffer());
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, drawContext->patchIndexBuffer);
|
||||
|
||||
// vertex attrib
|
||||
glEnableVertexAttribArray(0);
|
||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof (GLfloat) * 3, 0);
|
||||
|
||||
// bind other builtin texture buffers
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_BUFFER, drawContext->vertexTextureBuffer);
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glBindTexture(GL_TEXTURE_BUFFER, drawContext->vertexValenceTextureBuffer);
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
glBindTexture(GL_TEXTURE_BUFFER, drawContext->quadOffsetTextureBuffer);
|
||||
glActiveTexture(GL_TEXTURE3);
|
||||
glBindTexture(GL_TEXTURE_BUFFER, drawContext->ptexCoordinateTextureBuffer);
|
||||
}
|
||||
|
||||
void
|
||||
MyDrawDelegate::UnbindBatch(OpenSubdiv::OsdUtilMeshBatchBase<MyDrawContext> *batch) {
|
||||
|
||||
glBindVertexArray(0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
void
|
||||
MyDrawDelegate::BindEffect(MyEffect *effect) {
|
||||
// cross-patch state
|
||||
// bind ptex etc
|
||||
}
|
||||
|
||||
void
|
||||
MyDrawDelegate::UnbindEffect(MyEffect *effect) {
|
||||
}
|
||||
|
||||
void
|
||||
MyDrawDelegate::DrawElements(MyEffect *effect, OpenSubdiv::OsdDrawContext::PatchArray const &patchArray) {
|
||||
|
||||
// bind patchType-wise effect state
|
||||
// can be skipped (if config is not changed)
|
||||
MyDrawConfig *config = GetDrawConfig(effect, patchArray.GetDescriptor());
|
||||
|
||||
GLuint program = config->program;
|
||||
|
||||
if (true /* if config is different from previous call */) {
|
||||
glUseProgram(program);
|
||||
glPatchParameteri(GL_PATCH_VERTICES, patchArray.GetDescriptor().GetNumControlVertices());
|
||||
// bind patchArray state and draw
|
||||
}
|
||||
|
||||
// apply patch color
|
||||
effect->BindDrawConfig(config, patchArray.GetDescriptor());
|
||||
|
||||
glUniform1i(config->levelBaseUniform, patchArray.GetPatchIndex());
|
||||
if (patchArray.GetDescriptor().GetType() == OpenSubdiv::FarPatchTables::GREGORY ||
|
||||
patchArray.GetDescriptor().GetType() == OpenSubdiv::FarPatchTables::GREGORY_BOUNDARY){
|
||||
glUniform1i(config->gregoryQuadOffsetBaseUniform, patchArray.GetQuadOffsetIndex());
|
||||
}
|
||||
|
||||
if (patchArray.GetDescriptor().GetType() == OpenSubdiv::FarPatchTables::QUADS) {
|
||||
glDrawElements(GL_LINES_ADJACENCY, patchArray.GetNumIndices(), GL_UNSIGNED_INT,
|
||||
(void*)(patchArray.GetVertIndex()*sizeof(GLuint)));
|
||||
} else {
|
||||
glDrawElements(GL_PATCHES, patchArray.GetNumIndices(), GL_UNSIGNED_INT,
|
||||
(void*)(patchArray.GetVertIndex()*sizeof(GLuint)));
|
||||
}
|
||||
_numDrawCalls++;
|
||||
}
|
||||
|
||||
MyDrawConfig *
|
||||
MyDrawDelegate::GetDrawConfig(MyEffect *effectHandle, OpenSubdiv::OsdDrawContext::PatchDescriptor desc) {
|
||||
|
||||
return _effectRegistry.GetDrawConfig(effectHandle->GetEffectDescriptor(), desc);
|
||||
}
|
116
examples/glBatchViewer/delegate.h
Normal file
116
examples/glBatchViewer/delegate.h
Normal file
@ -0,0 +1,116 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#ifndef DELEGATE_H
|
||||
#define DELEGATE_H
|
||||
|
||||
#include <osd/cpuGLVertexBuffer.h>
|
||||
#include <osd/glDrawContext.h>
|
||||
#include <osd/glDrawRegistry.h>
|
||||
#include <osd_util/batch.h>
|
||||
|
||||
#include "effect.h"
|
||||
#include "effectRegistry.h"
|
||||
|
||||
class MyDrawContext : public OpenSubdiv::OsdGLDrawContext {
|
||||
public:
|
||||
virtual ~MyDrawContext();
|
||||
|
||||
template<class VERTEX_BUFFER>
|
||||
static MyDrawContext *
|
||||
Create(OpenSubdiv::FarMesh<OpenSubdiv::OsdVertex> *farMesh,
|
||||
VERTEX_BUFFER *vertexBuffer,
|
||||
bool requireFVarData=false) {
|
||||
|
||||
if (not vertexBuffer)
|
||||
return NULL;
|
||||
|
||||
MyDrawContext * instance = new MyDrawContext();
|
||||
if (instance->allocate(farMesh,
|
||||
vertexBuffer->BindVBO(),
|
||||
vertexBuffer->GetNumElements(),
|
||||
requireFVarData)) return instance;
|
||||
delete instance;
|
||||
return NULL;
|
||||
}
|
||||
//private:
|
||||
|
||||
GLuint vao;
|
||||
|
||||
private:
|
||||
MyDrawContext();
|
||||
|
||||
};
|
||||
|
||||
class MyDrawDelegate {
|
||||
public:
|
||||
void BindBatch(OpenSubdiv::OsdUtilMeshBatchBase<MyDrawContext> *batch);
|
||||
void UnbindBatch(OpenSubdiv::OsdUtilMeshBatchBase<MyDrawContext> *batch);
|
||||
void BindEffect(MyEffect *effect);
|
||||
void UnbindEffect(MyEffect *effect);
|
||||
void DrawElements(MyEffect *effect, OpenSubdiv::OsdDrawContext::PatchArray const &patchArray);
|
||||
|
||||
void ResetNumDrawCalls() { _numDrawCalls = 0; }
|
||||
int GetNumDrawCalls() const { return _numDrawCalls; }
|
||||
|
||||
private:
|
||||
MyDrawConfig *GetDrawConfig(MyEffect *effectHandle, OpenSubdiv::OsdDrawContext::PatchDescriptor desc);
|
||||
|
||||
MyEffectRegistry _effectRegistry;
|
||||
int _numDrawCalls;
|
||||
};
|
||||
|
||||
#endif /* DELEGATE_H */
|
223
examples/glBatchViewer/effect.cpp
Normal file
223
examples/glBatchViewer/effect.cpp
Normal file
@ -0,0 +1,223 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#if defined(__APPLE__)
|
||||
#include "TargetConditionals.h"
|
||||
#if TARGET_OS_IPHONE or TARGET_IPHONE_SIMULATOR
|
||||
#include <OpenGLES/ES2/gl.h>
|
||||
#else
|
||||
#include <OpenGL/gl3.h>
|
||||
#endif
|
||||
#elif defined(ANDROID)
|
||||
#include <GLES2/gl2.h>
|
||||
#else
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <GL/glew.h>
|
||||
#endif
|
||||
|
||||
#include "effect.h"
|
||||
#include "../common/simple_math.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
GLuint g_transformUB = 0,
|
||||
g_tessellationUB = 0,
|
||||
g_lightingUB = 0;
|
||||
|
||||
GLuint g_transformBinding = 0;
|
||||
GLuint g_tessellationBinding = 1;
|
||||
GLuint g_lightingBinding = 3;
|
||||
|
||||
|
||||
void
|
||||
MyEffect::SetMatrix(const float *modelview, const float *projection) {
|
||||
float mvp[16];
|
||||
multMatrix(mvp, modelview, projection);
|
||||
|
||||
struct Transform {
|
||||
float ModelViewMatrix[16];
|
||||
float ProjectionMatrix[16];
|
||||
float ModelViewProjectionMatrix[16];
|
||||
} transformData;
|
||||
memcpy(transformData.ModelViewMatrix, modelview, sizeof(float)*16);
|
||||
memcpy(transformData.ProjectionMatrix, projection, sizeof(float)*16);
|
||||
memcpy(transformData.ModelViewProjectionMatrix, mvp, sizeof(float)*16);
|
||||
|
||||
// set transform
|
||||
if (! g_transformUB) {
|
||||
glGenBuffers(1, &g_transformUB);
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, g_transformUB);
|
||||
glBufferData(GL_UNIFORM_BUFFER,
|
||||
sizeof(transformData), NULL, GL_STATIC_DRAW);
|
||||
};
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, g_transformUB);
|
||||
glBufferSubData(GL_UNIFORM_BUFFER,
|
||||
0, sizeof(transformData), &transformData);
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, 0);
|
||||
|
||||
glBindBufferBase(GL_UNIFORM_BUFFER, g_transformBinding, g_transformUB);
|
||||
}
|
||||
|
||||
void
|
||||
MyEffect::SetTessLevel(float tessLevel) {
|
||||
|
||||
struct Tessellation {
|
||||
float TessLevel;
|
||||
} tessellationData;
|
||||
tessellationData.TessLevel = tessLevel;
|
||||
|
||||
if (! g_tessellationUB) {
|
||||
glGenBuffers(1, &g_tessellationUB);
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, g_tessellationUB);
|
||||
glBufferData(GL_UNIFORM_BUFFER,
|
||||
sizeof(tessellationData), NULL, GL_STATIC_DRAW);
|
||||
};
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, g_tessellationUB);
|
||||
glBufferSubData(GL_UNIFORM_BUFFER,
|
||||
0, sizeof(tessellationData), &tessellationData);
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, 0);
|
||||
|
||||
glBindBufferBase(GL_UNIFORM_BUFFER, g_tessellationBinding, g_tessellationUB);
|
||||
}
|
||||
|
||||
void
|
||||
MyEffect::SetLighting() {
|
||||
|
||||
struct Lighting {
|
||||
struct Light {
|
||||
float position[4];
|
||||
float ambient[4];
|
||||
float diffuse[4];
|
||||
float specular[4];
|
||||
} lightSource[2];
|
||||
} lightingData = {
|
||||
{{ { 0.5, 0.2f, 1.0f, 0.0f },
|
||||
{ 0.1f, 0.1f, 0.1f, 1.0f },
|
||||
{ 0.7f, 0.7f, 0.7f, 1.0f },
|
||||
{ 0.8f, 0.8f, 0.8f, 1.0f } },
|
||||
|
||||
{ { -0.8f, 0.4f, -1.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, 0.0f, 1.0f },
|
||||
{ 0.5f, 0.5f, 0.5f, 1.0f },
|
||||
{ 0.8f, 0.8f, 0.8f, 1.0f } }}
|
||||
};
|
||||
|
||||
if (! g_lightingUB) {
|
||||
glGenBuffers(1, &g_lightingUB);
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, g_lightingUB);
|
||||
glBufferData(GL_UNIFORM_BUFFER,
|
||||
sizeof(lightingData), NULL, GL_STATIC_DRAW);
|
||||
};
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, g_lightingUB);
|
||||
glBufferSubData(GL_UNIFORM_BUFFER,
|
||||
0, sizeof(lightingData), &lightingData);
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, 0);
|
||||
|
||||
glBindBufferBase(GL_UNIFORM_BUFFER, g_lightingBinding, g_lightingUB);
|
||||
}
|
||||
|
||||
void
|
||||
MyEffect::BindDrawConfig(MyDrawConfig *config, OpenSubdiv::OsdDrawContext::PatchDescriptor desc) {
|
||||
|
||||
// bind uniforms
|
||||
|
||||
int patchType = desc.GetType();
|
||||
int patchPattern = desc.GetPattern();
|
||||
|
||||
GLint program = config->program;
|
||||
GLint diffuseColor = config->diffuseColorUniform;
|
||||
|
||||
if (displayPatchColor) {
|
||||
GLfloat patchColor[10][4] = {
|
||||
{ 1.0f, 1.0f, 1.0f, 1.0f }, // NON_PATCH
|
||||
{ 1.0f, 1.0f, 1.0f, 1.0f }, // POLYGON
|
||||
{ 1.0f, 1.0f, 1.0f, 1.0f }, // QUADS
|
||||
{ 1.0f, 1.0f, 1.0f, 1.0f }, // TRIANGLES
|
||||
{ 1.0f, 1.0f, 1.0f, 1.0f }, // LOOP
|
||||
{ 1.0f, 1.0f, 1.0f, 1.0f }, // REGULAR
|
||||
{ 0.8f, 0.0f, 0.0f, 1.0f }, // BOUNDARY
|
||||
{ 0.0f, 1.0f, 0.0f, 1.0f }, // CORNER
|
||||
{ 1.0f, 1.0f, 0.0f, 1.0f }, // GREGORY
|
||||
{ 1.0f, 0.5f, 0.0f, 1.0f }, // GREGORY_BOUNDARY
|
||||
};
|
||||
GLfloat regularTransitionColor[6][4] = {
|
||||
{ 1.0f, 1.0f, 1.0f, 1.0f }, // NON_TRANSITION
|
||||
{ 0.0f, 1.0f, 1.0f, 1.0f }, // PATTERN0
|
||||
{ 0.0f, 0.5f, 1.0f, 1.0f }, // PATTERN1
|
||||
{ 0.0f, 0.5f, 0.5f, 1.0f }, // PATTERN2
|
||||
{ 0.5f, 0.0f, 1.0f, 1.0f }, // PATTERN3
|
||||
{ 1.0f, 0.5f, 1.0f, 1.0f }, // PATTERN4
|
||||
};
|
||||
|
||||
if (patchPattern == OpenSubdiv::FarPatchTables::NON_TRANSITION) {
|
||||
glProgramUniform4fv(program, diffuseColor, 1, patchColor[patchType]);
|
||||
} else {
|
||||
if (patchType == OpenSubdiv::FarPatchTables::REGULAR) {
|
||||
glProgramUniform4fv(program, diffuseColor, 1, regularTransitionColor[patchPattern]);
|
||||
} else if (patchType == OpenSubdiv::FarPatchTables::BOUNDARY) {
|
||||
glProgramUniform4f(program, diffuseColor, 0, 0, 0.5f, 1);
|
||||
} else if (patchType == OpenSubdiv::FarPatchTables::CORNER) {
|
||||
glProgramUniform4f(program, diffuseColor, 0, 0, 0.5f, 1);
|
||||
} else {
|
||||
glProgramUniform4f(program, diffuseColor, 0.4f, 0.4f, 0.8f, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
133
examples/glBatchViewer/effect.h
Normal file
133
examples/glBatchViewer/effect.h
Normal file
@ -0,0 +1,133 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#ifndef EFFECT_H
|
||||
#define EFFECT_H
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#include "TargetConditionals.h"
|
||||
#if TARGET_OS_IPHONE or TARGET_IPHONE_SIMULATOR
|
||||
#include <OpenGLES/ES2/gl.h>
|
||||
#else
|
||||
#include <OpenGL/gl3.h>
|
||||
#endif
|
||||
#elif defined(ANDROID)
|
||||
#include <GLES2/gl2.h>
|
||||
#else
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
|
||||
#include <osd/patch.h>
|
||||
#include <osd/glDrawRegistry.h>
|
||||
|
||||
union EffectDesc {
|
||||
public:
|
||||
struct {
|
||||
unsigned int wire:2;
|
||||
unsigned int screenSpaceTess:1;
|
||||
};
|
||||
int value;
|
||||
|
||||
bool operator < (const EffectDesc &e) const {
|
||||
return value < e.value;
|
||||
}
|
||||
|
||||
int GetWire() const { return wire; }
|
||||
bool GetScreenSpaceTess() const { return screenSpaceTess; }
|
||||
};
|
||||
|
||||
struct MyDrawConfig : public OpenSubdiv::OsdGLDrawConfig {
|
||||
|
||||
MyDrawConfig() :
|
||||
diffuseColorUniform(-1) {}
|
||||
virtual ~MyDrawConfig() {}
|
||||
|
||||
GLint diffuseColorUniform;
|
||||
};
|
||||
|
||||
class MyEffect { // formerly EffectHandle
|
||||
public:
|
||||
EffectDesc GetEffectDescriptor() const {
|
||||
EffectDesc desc;
|
||||
|
||||
desc.value = 0;
|
||||
desc.wire = wire;
|
||||
desc.screenSpaceTess = screenSpaceTess;
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
||||
void BindDrawConfig(MyDrawConfig *config, OpenSubdiv::OsdDrawContext::PatchDescriptor desc);
|
||||
|
||||
void SetMatrix(const float *modelview, const float *projection);
|
||||
void SetTessLevel(float tessLevel);
|
||||
void SetLighting();
|
||||
|
||||
enum {
|
||||
kWire, kFill, kLine
|
||||
};
|
||||
|
||||
bool displayPatchColor; // runtime switchable
|
||||
|
||||
bool screenSpaceTess; // need recompile (should be considered in effect descriptor)
|
||||
int wire; // need recompile
|
||||
};
|
||||
|
||||
|
||||
#endif /* EFFECT_H */
|
190
examples/glBatchViewer/effectRegistry.cpp
Normal file
190
examples/glBatchViewer/effectRegistry.cpp
Normal file
@ -0,0 +1,190 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#if defined(__APPLE__)
|
||||
#include "TargetConditionals.h"
|
||||
#if TARGET_OS_IPHONE or TARGET_IPHONE_SIMULATOR
|
||||
#include <OpenGLES/ES2/gl.h>
|
||||
#else
|
||||
#include <OpenGL/gl3.h>
|
||||
#endif
|
||||
#elif defined(ANDROID)
|
||||
#include <GLES2/gl2.h>
|
||||
#else
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <GL/glew.h>
|
||||
#endif
|
||||
|
||||
#include "effectRegistry.h"
|
||||
|
||||
static const char *shaderSource =
|
||||
#if defined(GL_ARB_tessellation_shader) || defined(GL_VERSION_4_0)
|
||||
#include "shader.inc"
|
||||
#else
|
||||
#include "shader_gl3.inc"
|
||||
#endif
|
||||
;
|
||||
|
||||
|
||||
MyEffectRegistry::SourceConfigType *
|
||||
MyEffectRegistry::_CreateDrawSourceConfig(DescType const & desc) {
|
||||
|
||||
SourceConfigType * sconfig =
|
||||
BaseRegistry::_CreateDrawSourceConfig(desc.first);
|
||||
assert(sconfig);
|
||||
|
||||
EffectDesc effectDesc = desc.second;
|
||||
|
||||
if (effectDesc.GetScreenSpaceTess()) {
|
||||
sconfig->commonShader.AddDefine("OSD_ENABLE_PATCH_CULL");
|
||||
sconfig->commonShader.AddDefine("OSD_ENABLE_SCREENSPACE_TESSELLATION");
|
||||
}
|
||||
|
||||
const char *glslVersion = "#version 400\n";
|
||||
if (desc.first.GetType() == OpenSubdiv::FarPatchTables::QUADS) {
|
||||
sconfig->vertexShader.source = shaderSource;
|
||||
sconfig->vertexShader.version = glslVersion;
|
||||
sconfig->vertexShader.AddDefine("VERTEX_SHADER");
|
||||
} else {
|
||||
sconfig->geometryShader.AddDefine("SMOOTH_NORMALS");
|
||||
}
|
||||
|
||||
sconfig->geometryShader.source = shaderSource;
|
||||
sconfig->geometryShader.version = glslVersion;
|
||||
sconfig->geometryShader.AddDefine("GEOMETRY_SHADER");
|
||||
|
||||
sconfig->fragmentShader.source = shaderSource;
|
||||
sconfig->fragmentShader.version = glslVersion;
|
||||
sconfig->fragmentShader.AddDefine("FRAGMENT_SHADER");
|
||||
|
||||
if (desc.first.GetType() == OpenSubdiv::FarPatchTables::QUADS) {
|
||||
sconfig->geometryShader.AddDefine("PRIM_QUAD");
|
||||
sconfig->fragmentShader.AddDefine("PRIM_QUAD");
|
||||
} else {
|
||||
sconfig->geometryShader.AddDefine("PRIM_TRI");
|
||||
sconfig->fragmentShader.AddDefine("PRIM_TRI");
|
||||
}
|
||||
|
||||
int wire = effectDesc.GetWire();
|
||||
|
||||
if (wire == MyEffect::kWire) {
|
||||
sconfig->geometryShader.AddDefine("GEOMETRY_OUT_WIRE");
|
||||
sconfig->fragmentShader.AddDefine("GEOMETRY_OUT_WIRE");
|
||||
} else if (wire == MyEffect::kFill) {
|
||||
sconfig->geometryShader.AddDefine("GEOMETRY_OUT_FILL");
|
||||
sconfig->fragmentShader.AddDefine("GEOMETRY_OUT_FILL");
|
||||
} else if (wire == MyEffect::kLine) {
|
||||
sconfig->geometryShader.AddDefine("GEOMETRY_OUT_LINE");
|
||||
sconfig->fragmentShader.AddDefine("GEOMETRY_OUT_LINE");
|
||||
}
|
||||
|
||||
return sconfig;
|
||||
|
||||
}
|
||||
|
||||
MyEffectRegistry::ConfigType *
|
||||
MyEffectRegistry::_CreateDrawConfig(DescType const & desc, SourceConfigType const * sconfig) {
|
||||
|
||||
// XXX: make sure is this downcast correct
|
||||
ConfigType * config = (ConfigType *)BaseRegistry::_CreateDrawConfig(desc.first, sconfig);
|
||||
assert(config);
|
||||
|
||||
GLuint uboIndex;
|
||||
GLuint program = config->program;
|
||||
|
||||
GLuint g_transformBinding = 0,
|
||||
g_tessellationBinding = 0,
|
||||
g_lightingBinding = 0;
|
||||
|
||||
// XXXdyu can use layout(binding=) with GLSL 4.20 and beyond
|
||||
g_transformBinding = 0;
|
||||
uboIndex = glGetUniformBlockIndex(program, "Transform");
|
||||
if (uboIndex != GL_INVALID_INDEX)
|
||||
glUniformBlockBinding(program, uboIndex, g_transformBinding);
|
||||
|
||||
g_tessellationBinding = 1;
|
||||
uboIndex = glGetUniformBlockIndex(program, "Tessellation");
|
||||
if (uboIndex != GL_INVALID_INDEX)
|
||||
glUniformBlockBinding(program, uboIndex, g_tessellationBinding);
|
||||
|
||||
g_lightingBinding = 3;
|
||||
uboIndex = glGetUniformBlockIndex(program, "Lighting");
|
||||
if (uboIndex != GL_INVALID_INDEX)
|
||||
glUniformBlockBinding(program, uboIndex, g_lightingBinding);
|
||||
|
||||
// g_gregoryQuadOffsetBaseMap[program] = glGetUniformLocation(program, "GregoryQuadOffsetBase");
|
||||
// g_levelBaseMap[program] = glGetUniformLocation(program, "LevelBase");
|
||||
|
||||
GLint loc;
|
||||
if ((loc = glGetUniformLocation(program, "g_VertexBuffer")) != -1) {
|
||||
glProgramUniform1i(program, loc, 0); // GL_TEXTURE0
|
||||
}
|
||||
if ((loc = glGetUniformLocation(program, "g_ValenceBuffer")) != -1) {
|
||||
glProgramUniform1i(program, loc, 1); // GL_TEXTURE1
|
||||
}
|
||||
if ((loc = glGetUniformLocation(program, "g_QuadOffsetBuffer")) != -1) {
|
||||
glProgramUniform1i(program, loc, 2); // GL_TEXTURE2
|
||||
}
|
||||
if ((loc = glGetUniformLocation(program, "g_ptexIndicesBuffer")) != -1) {
|
||||
glProgramUniform1i(program, loc, 3); // GL_TEXTURE3
|
||||
}
|
||||
|
||||
config->diffuseColorUniform = glGetUniformLocation(program, "diffuseColor");
|
||||
|
||||
return config;
|
||||
}
|
79
examples/glBatchViewer/effectRegistry.h
Normal file
79
examples/glBatchViewer/effectRegistry.h
Normal file
@ -0,0 +1,79 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#ifndef EFFECT_REGISTRY_H
|
||||
#define EFFECT_REGISTRY_H
|
||||
|
||||
#include <osd/glDrawRegistry.h>
|
||||
#include "effect.h"
|
||||
|
||||
typedef std::pair<OpenSubdiv::OsdDrawContext::PatchDescriptor, EffectDesc> FullEffectDesc; // name!
|
||||
|
||||
class MyEffectRegistry : public OpenSubdiv::OsdGLDrawRegistry<FullEffectDesc, MyDrawConfig> {
|
||||
typedef OpenSubdiv::OsdGLDrawRegistry<FullEffectDesc, MyDrawConfig> BaseClass;
|
||||
|
||||
protected:
|
||||
virtual ConfigType *_CreateDrawConfig(DescType const & desc, SourceConfigType const * sconfig);
|
||||
virtual SourceConfigType *_CreateDrawSourceConfig(DescType const & desc);
|
||||
|
||||
public:
|
||||
ConfigType * GetDrawConfig(EffectDesc effectDesc, OpenSubdiv::OsdDrawContext::PatchDescriptor desc) {
|
||||
return BaseClass::GetDrawConfig(FullEffectDesc(desc, effectDesc));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif /* EFFECT_REGISTRY_H */
|
195
examples/glBatchViewer/shapes.h
Normal file
195
examples/glBatchViewer/shapes.h
Normal file
@ -0,0 +1,195 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
|
||||
void initializeShapes( ) {
|
||||
|
||||
#include <shapes/catmark_cube_corner0.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_cube_corner0, "catmark_cube_corner0", kCatmark));
|
||||
|
||||
#include <shapes/catmark_cube_corner1.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_cube_corner1, "catmark_cube_corner1", kCatmark));
|
||||
|
||||
#include <shapes/catmark_cube_corner2.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_cube_corner2, "catmark_cube_corner2", kCatmark));
|
||||
|
||||
#include <shapes/catmark_cube_corner3.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_cube_corner3, "catmark_cube_corner3", kCatmark));
|
||||
|
||||
#include <shapes/catmark_cube_corner4.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_cube_corner4, "catmark_cube_corner4", kCatmark));
|
||||
|
||||
#include <shapes/catmark_cube_creases0.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_cube_creases0, "catmark_cube_creases0", kCatmark));
|
||||
|
||||
#include <shapes/catmark_cube_creases1.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_cube_creases1, "catmark_cube_creases1", kCatmark));
|
||||
|
||||
#include <shapes/catmark_cube.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_cube, "catmark_cube", kCatmark));
|
||||
|
||||
#include <shapes/catmark_dart_edgecorner.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_dart_edgecorner, "catmark_dart_edgecorner", kCatmark));
|
||||
|
||||
#include <shapes/catmark_dart_edgeonly.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_dart_edgeonly, "catmark_dart_edgeonly", kCatmark));
|
||||
|
||||
#include <shapes/catmark_edgecorner.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_edgecorner ,"catmark_edgecorner", kCatmark));
|
||||
|
||||
#include <shapes/catmark_edgeonly.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_edgeonly, "catmark_edgeonly", kCatmark));
|
||||
|
||||
#include <shapes/catmark_gregory_test1.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_gregory_test1, "catmark_gregory_test1", kCatmark));
|
||||
|
||||
#include <shapes/catmark_gregory_test2.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_gregory_test2, "catmark_gregory_test2", kCatmark));
|
||||
|
||||
#include <shapes/catmark_gregory_test3.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_gregory_test3, "catmark_gregory_test3", kCatmark));
|
||||
|
||||
#include <shapes/catmark_gregory_test4.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_gregory_test4, "catmark_gregory_test4", kCatmark));
|
||||
|
||||
#include <shapes/catmark_pyramid_creases0.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_pyramid_creases0, "catmark_pyramid_creases0", kCatmark));
|
||||
|
||||
#include <shapes/catmark_pyramid_creases1.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_pyramid_creases1, "catmark_pyramid_creases1", kCatmark));
|
||||
|
||||
#include <shapes/catmark_pyramid.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_pyramid, "catmark_pyramid", kCatmark));
|
||||
|
||||
#include <shapes/catmark_tent_creases0.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_tent_creases0, "catmark_tent_creases0", kCatmark));
|
||||
|
||||
#include <shapes/catmark_tent_creases1.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_tent_creases1, "catmark_tent_creases1", kCatmark));
|
||||
|
||||
#include <shapes/catmark_tent.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_tent, "catmark_tent", kCatmark));
|
||||
|
||||
#include <shapes/catmark_torus.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_torus, "catmark_torus", kCatmark));
|
||||
|
||||
#include <shapes/catmark_torus_creases0.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_torus_creases0, "catmark_torus_creases0", kCatmark));
|
||||
|
||||
#include <shapes/catmark_square_hedit0.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_square_hedit0, "catmark_square_hedit0", kCatmark));
|
||||
|
||||
#include <shapes/catmark_square_hedit1.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_square_hedit1, "catmark_square_hedit1", kCatmark));
|
||||
|
||||
#include <shapes/catmark_square_hedit2.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_square_hedit2, "catmark_square_hedit2", kCatmark));
|
||||
|
||||
#include <shapes/catmark_square_hedit3.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_square_hedit3, "catmark_square_hedit3", kCatmark));
|
||||
|
||||
|
||||
|
||||
#ifndef WIN32 // exceeds max string literal (65535 chars)
|
||||
#include <shapes/catmark_bishop.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_bishop, "catmark_bishop", kCatmark));
|
||||
#endif
|
||||
|
||||
#ifndef WIN32 // exceeds max string literal (65535 chars)
|
||||
#include <shapes/catmark_car.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_car, "catmark_car", kCatmark));
|
||||
#endif
|
||||
|
||||
#include <shapes/catmark_helmet.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_helmet, "catmark_helmet", kCatmark));
|
||||
|
||||
#include <shapes/catmark_pawn.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_pawn, "catmark_pawn", kCatmark));
|
||||
|
||||
#ifndef WIN32 // exceeds max string literal (65535 chars)
|
||||
#include <shapes/catmark_rook.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_rook, "catmark_rook", kCatmark));
|
||||
#endif
|
||||
|
||||
|
||||
#include <shapes/bilinear_cube.h>
|
||||
g_defaultShapes.push_back(SimpleShape(bilinear_cube, "bilinear_cube", kBilinear));
|
||||
|
||||
|
||||
#include <shapes/loop_cube_creases0.h>
|
||||
g_defaultShapes.push_back(SimpleShape(loop_cube_creases0, "loop_cube_creases0", kLoop));
|
||||
|
||||
#include <shapes/loop_cube_creases1.h>
|
||||
g_defaultShapes.push_back(SimpleShape(loop_cube_creases1, "loop_cube_creases1", kLoop));
|
||||
|
||||
#include <shapes/loop_cube.h>
|
||||
g_defaultShapes.push_back(SimpleShape(loop_cube, "loop_cube", kLoop));
|
||||
|
||||
#include <shapes/loop_icosahedron.h>
|
||||
g_defaultShapes.push_back(SimpleShape(loop_icosahedron, "loop_icosahedron", kLoop));
|
||||
|
||||
#include <shapes/loop_saddle_edgecorner.h>
|
||||
g_defaultShapes.push_back(SimpleShape(loop_saddle_edgecorner, "loop_saddle_edgecorner", kLoop));
|
||||
|
||||
#include <shapes/loop_saddle_edgeonly.h>
|
||||
g_defaultShapes.push_back(SimpleShape(loop_saddle_edgeonly, "loop_saddle_edgeonly", kLoop));
|
||||
|
||||
#include <shapes/loop_triangle_edgecorner.h>
|
||||
g_defaultShapes.push_back(SimpleShape(loop_triangle_edgecorner, "loop_triangle_edgecorner", kLoop));
|
||||
|
||||
#include <shapes/loop_triangle_edgeonly.h>
|
||||
g_defaultShapes.push_back(SimpleShape(loop_triangle_edgeonly, "loop_triangle_edgeonly", kLoop));
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user