本文整理汇总了C++中StaticObject::setClassType方法的典型用法代码示例。如果您正苦于以下问题:C++ StaticObject::setClassType方法的具体用法?C++ StaticObject::setClassType怎么用?C++ StaticObject::setClassType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StaticObject
的用法示例。
在下文中一共展示了StaticObject::setClassType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
//geko.setSourceName(BACKGROUNDMUSIC, "Hintergrund", RESOURCES_PATH "/Sound/jingle2.wav");
geko.setSourceName(FIGHTSOUND, "Kampfsound", RESOURCES_PATH "/Sound/punch.wav");
geko.setSourceName(EATSOUND, "Essen", RESOURCES_PATH "/Sound/Munching.wav");
geko.setSourceName(QUESTSOUND, "Quest", RESOURCES_PATH "/Sound/jingle.wav");
geko.setSourceName(ITEMSOUND, "Item", RESOURCES_PATH "/Sound/itempickup.wav");
geko.setSourceName(FIRESOUND, "Fire", RESOURCES_PATH "/Sound/Feuer_kurz.wav");
sfh.disableLooping("Essen");
sfh.disableLooping("Quest");
sfh.disableLooping("Item");
//sfh.generateSource("Feuer",posFood, RESOURCES_PATH "/Sound/Feuer kurz.wav");
playerNode.setCamera(&cam);
//===================================================================//
//==================Object declarations - Geometry, Texture, Node=== //
//==========================Object: Tree===========================//
StaticObject treeStatic;
treeStatic.setTree();
TreeMesh tree;
Node treeNode("Tree");
treeNode.addGeometry(&tree);
treeNode.setObject(&treeStatic);
treeNode.addTranslation(posFood);
treeNode.getBoundingSphere()->radius = 3.0;
//===================================================================//
//==================Object declarations - Geometry, Texture, Node=== //
//==========================Object: Plane===========================//
StaticObject terrainObject;
terrainObject.setClassType(ClassType::TERRAIN);
Plane terrain;
Texture terrainTex((char*)RESOURCES_PATH "/Grass.jpg");
Node terrainNode("Plane");
terrainNode.addGeometry(&terrain);
terrainNode.addTexture(&terrainTex);
terrainNode.setObject(&terrainObject);
terrainNode.addTranslation(0.0, -0.75, 0.0);
terrainNode.addRotation(90.0f, glm::vec3(1.0, 0.0, 0.0));
terrainNode.addScale(20.0, 20.0, 20.0);
//===================================================================//
//==================Setting up the Level and Scene==================//
//==================================================================//
Level testLevel("testLevel");
Scene testScene("testScene");
testLevel.addScene(&testScene);
testLevel.changeScene("testScene");
testLevel.getFightSystem()->setParticle(particle);
//==================Add Camera to Scene============================//
testScene.getScenegraph()->addCamera(&cam);
testScene.getScenegraph()->setActiveCamera("PlayerViewCam");
//==================Set Input-Maps and activate one================//
iH.setAllInputMaps(*(testScene.getScenegraph()->getActiveCamera()));
iH.changeActiveInputMap(MapType::OBJECT);
iH.getActiveInputMap()->update(geko);
//==================Add Objects to the Scene=======================//
示例2: main
//===================================================================//
//==================Main Method=====================================//
//==================================================================//
int main()
{
//===================================================================//
//==================Things you need to start with====================//
//==================================================================//
glfwInit();
Window testWindow(500, 50, 800, 600, "Demo");
glfwMakeContextCurrent(testWindow.getWindow());
// Callback
glfwSetKeyCallback(testWindow.getWindow(), key_callback);
cam.setKeySpeed(2.0);
cam.setNearFar(0.01, 100);
glewInit();
OpenGL3Context context;
//renderer = new Renderer(context);
Renderer renderer(context);
//===================================================================//
//==================Shaders for your program========================//
//==================================================================//
VertexShader vs(loadShaderSource(SHADERS_PATH + std::string("/Vertex-Shaders/TextureShader3D.vert")));
FragmentShader fs(loadShaderSource(SHADERS_PATH + std::string("/Fragment-Shaders/TextureShader3D.frag")));
ShaderProgram shader(vs, fs);
VertexShader vsGBuffer(loadShaderSource(SHADERS_PATH + std::string("/GBuffer/GBuffer.vert")));
FragmentShader fsGBuffer(loadShaderSource(SHADERS_PATH + std::string("/GBuffer/GBuffer.frag")));
ShaderProgram shaderGBuffer(vsGBuffer, fsGBuffer);
VertexShader vsSfq(loadShaderSource(SHADERS_PATH + std::string("/ScreenFillingQuad/ScreenFillingQuad.vert")));
FragmentShader fsSfq(loadShaderSource(SHADERS_PATH + std::string("/ScreenFillingQuad/ScreenFillingQuad.frag")));
ShaderProgram shaderSFQ(vsSfq, fsSfq);
VertexShader vsSkybox(loadShaderSource(SHADERS_PATH + std::string("/SkyboxShader/SkyboxShader.vert")));
FragmentShader fsSkybox(loadShaderSource(SHADERS_PATH + std::string("/SkyboxShader/SkyboxShader.frag")));
ShaderProgram shaderSkybox(vsSkybox, fsSkybox);
FBO fboGBuffer(WINDOW_WIDTH, WINDOW_HEIGHT, 3, true, false);
SoundFileHandler sfh = SoundFileHandler(1000);
Rect screenFillingQuad;
screenFillingQuad.loadBufferData();
//===================================================================//
//==================Object declarations - Geometry, Texture, Node=== //
//==========================Object: Terrain===========================//
StaticObject terrainObject;
terrainObject.setClassType(ClassType::TERRAIN);
Texture terrainTex((char*)RESOURCES_PATH "/Grass2.jpg");
Terrain terrain2((char*)RESOURCES_PATH "/heightmap.jpg", 0.0f, 0.0f);
Node terrainNode2("Terrain");
terrainNode2.addGeometry(&terrain2);
terrainNode2.addTexture(&terrainTex);
terrainNode2.setObject(&terrainObject);
//===================================================================//
//==================Object declarations - Geometry, Texture, Node=== //
//==========================Object: Player===========================//
Texture texCV((char*)RESOURCES_PATH "/cv_logo.bmp");
GekoMesh gekoMesh;
geko.setExp(0.0);
geko.setLevelThreshold(100.0);
geko.setLevel(0);
Node playerNode("Player");
playerNode.addGeometry(&gekoMesh);
playerNode.setObject(&geko);
playerNode.addTexture(&texCV);
sfh.generateSource(glm::vec3(geko.getPosition()), RESOURCES_PATH "/Sound/Rascheln.wav");
geko.setSoundHandler(&sfh);
geko.setSourceName(MOVESOUND, "SpielerFootsteps", RESOURCES_PATH "/Sound/Rascheln.wav");
//geko.setSourceName(BACKGROUNDMUSIC, "Hintergrund", RESOURCES_PATH "/Sound/jingle2.wav");
geko.setSourceName(FIGHTSOUND, "Kampfsound", RESOURCES_PATH "/Sound/punch.wav");
geko.setSourceName(EATSOUND, "Essen", RESOURCES_PATH "/Sound/Munching.wav");
geko.setSourceName(QUESTSOUND, "Quest", RESOURCES_PATH "/Sound/jingle.wav");
geko.setSourceName(ITEMSOUND, "Item", RESOURCES_PATH "/Sound/itempickup.wav");
geko.setSourceName(FIRESOUND, "Fire", RESOURCES_PATH "/Sound/Feuer_kurz.wav");
sfh.disableLooping("Essen");
sfh.disableLooping("Quest");
sfh.disableLooping("Item");
geko.setPosition(glm::vec4(terrain2.getResolutionX() / 2.0f, 10.0f, terrain2.getResolutionY() / 2.0f, 1.0));
//sfh.generateSource("Feuer",posFood, RESOURCES_PATH "/Sound/Feuer kurz.wav");
//.........这里部分代码省略.........