本文整理汇总了C++中Geometry::addPerVertexColor方法的典型用法代码示例。如果您正苦于以下问题:C++ Geometry::addPerVertexColor方法的具体用法?C++ Geometry::addPerVertexColor怎么用?C++ Geometry::addPerVertexColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Geometry
的用法示例。
在下文中一共展示了Geometry::addPerVertexColor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
void AvatarScalpel::init() {
m_isSweptQuadValid = false;
m_vSweptQuad.resize(4);
m_edgeref0 = vec3f(-2.0, 0, 0);
m_edgeref1 = vec3f(2.0, 0, 0);
vec3f lo = vec3f(m_edgeref0.x, 0.0f, -0.001f);
vec3f hi = vec3f(m_edgeref1.x, 1.0f, 0.001);
//Geometry
Geometry g;
g.init(3, 4, 2, ftTriangles);
g.addCube(lo, hi);
g.addPerVertexColor(vec4f(0, 1, 0, 1), g.countVertices());
SGMesh::setup(g);
//Outline
Geometry gWireframe;
gWireframe.init(3, 4, 2, ftQuads);
gWireframe.addCube(lo, hi);
m_outline.setup(gWireframe);
m_outline.setWireFrameMode(true);
resetTransform();
if(TheShaderManager::Instance().has("phong")) {
m_spEffect = SmartPtrSGEffect(new SGEffect(TheShaderManager::Instance().get("phong")));
}
}
示例2: main
int main(int argc, char* argv[]) {
cout << "Cutting tets" << endl;
g_parser.add_option("input", "[filepath] set input file in vega format",
Value(AnsiStr("internal")));
g_parser.add_toggle("ringscalpel", "If the switch presents then the ring scalpel will be used");
g_parser.add_option("example",
"[one, two, cube, eggshell] set an internal example",
Value(AnsiStr("two")));
g_parser.add_option("gizmo",
"loads a file to set gizmo location and orientation",
Value(AnsiStr("gizmo.ini")));
if (g_parser.parse(argc, argv) < 0)
exit(0);
//file path
g_strFilePath = ExtractFilePath(GetExePath()) + g_parser.value<AnsiStr>("input");
if (FileExists(g_strFilePath))
LogInfoArg1("input file: %s.", g_strFilePath.cptr());
else
g_strFilePath = "";
//Initialize app
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_STENCIL);
glutInitWindowSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
glutCreateWindow("SoftRigidDynamics - Pourya Shirazian");
glutDisplayFunc(draw);
glutReshapeFunc(def_resize);
glutMouseFunc(MousePress);
glutPassiveMotionFunc(MousePassiveMove);
glutMotionFunc(MouseMove);
glutMouseWheelFunc(MouseWheel);
glutKeyboardFunc(NormalKey);
glutSpecialFunc(SpecialKey);
glutCloseFunc(closeApp);
glutIdleFunc(timestep);
def_initgl();
//Build Shaders for drawing the mesh
AnsiStr strRoot = ExtractOneLevelUp(ExtractFilePath(GetExePath()));
AnsiStr strShaderRoot = strRoot + "data/shaders/";
AnsiStr strMeshRoot = strRoot + "data/meshes/";
AnsiStr strTextureRoot = strRoot + "data/textures/";
AnsiStr strLeftPial = strMeshRoot + "brain/pial_Full_obj/lh.pial.obj";
AnsiStr strRightPial = strMeshRoot + "brain/pial_Full_obj/rh.pial.obj";
//Load Shaders
TheShaderManager::Instance().addFromFolder(strShaderRoot.cptr());
//Load Textures
TheTexManager::Instance().add(strTextureRoot + "wood.png");
TheTexManager::Instance().add(strTextureRoot + "rendermask.png");
TheTexManager::Instance().add(strTextureRoot + "maskalpha.png");
TheTexManager::Instance().add(strTextureRoot + "maskalphafilled.png");
TheTexManager::Instance().add(strTextureRoot + "spin.png");
//Ground and Room
//TheSceneGraph::Instance().addFloor(32, 32, 0.5f);
TheSceneGraph::Instance().addSceneBox(AABB(vec3f(-10, -10, -16), vec3f(10, 10, 16)));
//floor
Geometry g;
g.addCube(vec3f(-8, -2.0, -8), vec3f(8, -1.8, 8));
g.addPerVertexColor(vec4f(0.5, 0.5, 0.5, 1));
SGBulletRigidMesh* floor = new SGBulletRigidMesh();
floor->setup(g, 0.0);
floor->setName("floor");
TheSceneGraph::Instance().addRigidBody(floor);
//create rigid bodies
/*
Geometry g1;
g1.addCube(vec3f(0.0, 0.0, 0.0), 1.0);
g1.addPerVertexColor(vec4f(0, 0, 1, 1));
for(int i=0; i < 8; i ++) {
for(int j=0; j < 8; j++) {
g1.colors().clear();
float r = RandRangeT<float>(0.0, 1.0);
float g = RandRangeT<float>(0.0, 1.0);
float b = RandRangeT<float>(0.0, 1.0);
g1.addPerVertexColor(vec4f(r, g, b, 1.0f));
SGBulletRigidMesh* acube = new SGBulletRigidMesh();
acube->transform()->setTranslate(vec3f(i-3, 10.0, j-3));
acube->setup(g1, 1.0);
TheSceneGraph::Instance().addRigidBody(acube);
}
}
*/
//Scalpel
//.........这里部分代码省略.........