本文整理汇总了C++中Cube::constructGeometry方法的典型用法代码示例。如果您正苦于以下问题:C++ Cube::constructGeometry方法的具体用法?C++ Cube::constructGeometry怎么用?C++ Cube::constructGeometry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cube
的用法示例。
在下文中一共展示了Cube::constructGeometry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
void init()
{
glClearColor(1.0,1.0,1.0,0.0); //sets the clear colour to yellow
//glClear(GL_COLOR_BUFFER_BIT) in the display function//will clear the buffer to this colour.
// Shaders
if(!myShader.load("BasicView", "glslfiles/basicTransformations.vert", "glslfiles/basicTransformations.frag"))
{
cout << "failed to load shader" << endl;
}
if (!cubeShader.load("BasicView", "glslfiles/cubeShader.vert", "glslfiles/cubeShader.frag"))
{
cout << "failed to load shader" << endl;
}
cubeOne.setDim(15);
cubeOne.constructGeometry(&cubeShader);
worldCube.setDim(1000);
worldCube.constructGeometry(&cubeShader);
glEnable(GL_TEXTURE_2D);
copter.loadModel(myShader);
prop.loadModel(myShader);
world.loadModel(myShader);
ground.loadModel(myShader);
houseOne.loadModel(myShader, "TestModels/dododododhouse2.obj", glm::vec3(50, 44, 50),
glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 0);
houseTwo.loadModel(myShader, "TestModels/pyramidhouse2.obj", glm::vec3(-1250, 44, 1000),
glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 0);
houseThree.loadModel(myShader, "TestModels/pyramidhouse2.obj", glm::vec3(-500, 44, -500),
glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 0);
houseFour.loadModel(myShader, "TestModels/pyramidhouse2.obj", glm::vec3(1200, 44, 1200),
glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 0);
houseFive.loadModel(myShader, "TestModels/dododododhouse2.obj", glm::vec3(50, 44, -1150),
glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 0);
houseSix.loadModel(myShader, "TestModels/dododododhouse2.obj", glm::vec3(-900, 44, -500),
glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 0);
treeOne.loadModel(myShader, "TestModels/tree.obj", glm::vec3(250, 20, 250),
glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 50);
treeTwo.loadModel(myShader, "TestModels/tree.obj", glm::vec3(350, 20, 250),
glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 50);
treeThree.loadModel(myShader, "TestModels/tree.obj", glm::vec3(300, 20, 250),
glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 50);
treeFour.loadModel(myShader, "TestModels/tree.obj", glm::vec3(0, 20, 750),
glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 50);
treeFive.loadModel(myShader, "TestModels/tree.obj", glm::vec3(200, 20, 180),
glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 50);
treeOne.loadModel(myShader, "TestModels/tree.obj", glm::vec3(-900, 20, 580),
glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 50);
treeTwo.loadModel(myShader, "TestModels/tree.obj", glm::vec3(1040, 20, 1050),
glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 50);
treeThree.loadModel(myShader, "TestModels/tree.obj", glm::vec3(-1260, 20, -250),
glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 50);
treeFour.loadModel(myShader, "TestModels/tree.obj", glm::vec3(1270, 20, 250),
glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 50);
treeFive.loadModel(myShader, "TestModels/tree.obj", glm::vec3(-230, 20, 250),
glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 50);
leafOne.loadModel(myShader, "TestModels/leaf.obj", glm::vec3(150, -10, 580),
glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 50);
leafTwo.loadModel(myShader, "TestModels/leaf.obj", glm::vec3(170, -10, 530),
glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 50);
leafThree.loadModel(myShader, "TestModels/leaf.obj", glm::vec3(150, -10, 550),
glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 50);
leafFour.loadModel(myShader, "TestModels/leaf.obj", glm::vec3(150, -10, 510),
glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 50);
houses.push_back(houseOne);
houses.push_back(houseTwo);
houses.push_back(houseThree);
houses.push_back(houseFour);
houses.push_back(houseFive);
houses.push_back(houseSix);
trees.push_back(treeOne);
trees.push_back(treeTwo);
trees.push_back(treeThree);
trees.push_back(treeFour);
trees.push_back(treeFive);
trees.push_back(treeSix);
trees.push_back(treeSeven);
trees.push_back(treeEight);
trees.push_back(treeNine);
trees.push_back(treeTen);
leafs.push_back(leafOne);
leafs.push_back(leafTwo);
leafs.push_back(leafThree);
leafs.push_back(leafFour);
glEnable(GL_DEPTH_TEST);
}
示例2: initAxisHandleObjects
void Handle::initAxisHandleObjects()
{
// assumes none of them have been created yet
Handle::pObjectXTranslateHandleLine = new Cylinder(1.0f, 0.03f, 6, 1);
Handle::pObjectYTranslateHandleLine = new Cylinder(1.0f, 0.03f, 6, 1);
Handle::pObjectZTranslateHandleLine = new Cylinder(1.0f, 0.03f, 6, 1);
Handle::pObjectXTranslateHandleHead = new Cone(0.2f, 0.07f, 8);
Handle::pObjectYTranslateHandleHead = new Cone(0.2f, 0.07f, 8);
Handle::pObjectZTranslateHandleHead = new Cone(0.2f, 0.07f, 8);
Cylinder *pX = Handle::pObjectXTranslateHandleLine;
Cylinder *pY = Handle::pObjectYTranslateHandleLine;
Cylinder *pZ = Handle::pObjectZTranslateHandleLine;
pX->setObjectID(eXTranslate);
pX->setPosition(Point(0.6f, 0.0f, 0.0f));
pX->rotate(0.0f, 0.0f, 90.0f);
pX->constructGeometry();
pY->setObjectID(eYTranslate);
pY->setPosition(Point(0.0f, 0.6f, 0.0f));
pY->constructGeometry();
pZ->setObjectID(eZTranslate);
pZ->setPosition(Point(0.0f, 0.0f, 0.6f));
pZ->rotate(-90.0f, 0.0f, 0.0f);
pZ->constructGeometry();
Cone *pXHead = Handle::pObjectXTranslateHandleHead;
Cone *pYHead = Handle::pObjectYTranslateHandleHead;
Cone *pZHead = Handle::pObjectZTranslateHandleHead;
pXHead->setObjectID(eXTranslate);
pXHead->setPosition(Point(1.1f, 0.0f, 0.0f));
pXHead->rotate(0.0f, 0.0f, -90.0f);
pXHead->constructGeometry();
pYHead->setObjectID(eYTranslate);
pYHead->setPosition(Point(0.0f, 1.1f, 0.0f));
pYHead->constructGeometry();
pZHead->setObjectID(eZTranslate);
pZHead->setPosition(Point(0.0f, 0.0f, 1.1f));
pZHead->rotate(90.0f, 0.0f, 0.0f);
pZHead->constructGeometry();
/// object rotate
Torus* pXRotate = new Torus(kObjectRotateHandleThickness, kObjectRotateHandleRadius, kObjectRotateHandleSegments, kObjectRotateHandleSides);
Torus* pYRotate = new Torus(kObjectRotateHandleThickness, kObjectRotateHandleRadius, kObjectRotateHandleSegments, kObjectRotateHandleSides);
Torus* pZRotate = new Torus(kObjectRotateHandleThickness, kObjectRotateHandleRadius, kObjectRotateHandleSegments, kObjectRotateHandleSides);
Handle::pObjectXRotateHandleLoop = pXRotate;
Handle::pObjectYRotateHandleLoop = pYRotate;
Handle::pObjectZRotateHandleLoop = pZRotate;
pXRotate->setObjectID(eXRotate);
pXRotate->rotate(0.0f, 0.0f, -90.0f);
pXRotate->constructGeometry();
pYRotate->setObjectID(eYRotate);
pYRotate->rotate(0.0f, 0.0f, 0.0f);
pYRotate->constructGeometry();
pZRotate->setObjectID(eZRotate);
pZRotate->rotate(90.0f, 0.0f, 0.0f);
pZRotate->constructGeometry();
/// face
Handle::pFaceNormalTranslateHandleLine = new Cylinder(1.0f, 0.03f, 6, 1);
Handle::pFaceNormalTranslateHandleHead = new Cone(0.2f, 0.07f, 8);
Handle::pFaceExtrude = new Cube(0.05f);
Cylinder* pFaceNormalLine = Handle::pFaceNormalTranslateHandleLine;
pFaceNormalLine->setObjectID(eFaceNormalTranslate);
pFaceNormalLine->setPosition(Point(0.0f, 0.6f, 0.0f));
pFaceNormalLine->constructGeometry();
Cone* pFaceNormalHead = Handle::pFaceNormalTranslateHandleHead;
pFaceNormalHead->setObjectID(eFaceNormalTranslate);
pFaceNormalHead->setPosition(Point(0.0f, 1.1f, 0.0f));
pFaceNormalHead->constructGeometry();
Cube* pFaceExtrude = Handle::pFaceExtrude;
pFaceExtrude->setObjectID(eFaceExtrude);
pFaceExtrude->setPosition(Point(0.0f, 1.4f, 0.0f));
pFaceExtrude->constructGeometry();
Handle::pFaceTranslateXLine = new Cylinder(1.0f, 0.03f, 6, 1);
Handle::pFaceTranslateYLine = new Cylinder(1.0f, 0.03f, 6, 1);
Cylinder* pFaceTranslateXLine = Handle::pFaceTranslateXLine;
pFaceTranslateXLine->setObjectID(eFaceTranslateX);
pFaceTranslateXLine->setRotation(Vector(0.0f, 0.0f, -90.0f));
pFaceTranslateXLine->setPosition(Point(0.6f, 0.0f, 0.0f));
pFaceTranslateXLine->constructGeometry();
//.........这里部分代码省略.........