MCPcopy Create free account
hub / github.com/OGRECave/ogre / setupContent

Function setupContent

Samples/Simple/include/TextureArray.h:30–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28 }
29
30 void setupContent() override
31 {
32 mSceneMgr->setSkyBox(true, "Examples/TrippySkyBox");
33
34 // set our camera to orbit around the origin and show cursor
35 mCameraMan->setStyle(CS_ORBIT);
36 mTrayMgr->showCursor();
37
38 // the names of the textures we will use (all need to be the same size: 512*512 in our case)
39 std::vector<String> texNames;
40 texNames.push_back("BeachStones.jpg");
41 texNames.push_back("BumpyMetal.jpg");
42 texNames.push_back("egyptrockyfull.jpg");
43 texNames.push_back("frost.png");
44 texNames.push_back("MtlPlat2.jpg");
45 texNames.push_back("nskingr.jpg");
46 texNames.push_back("Panels_Diffuse.png");
47 texNames.push_back("Panels_reflection.png");
48 texNames.push_back("RustedMetal.jpg");
49 texNames.push_back("spacesky.jpg");
50 texNames.push_back("terrain_texture.jpg");
51 texNames.push_back("texmap2.jpg");
52 texNames.push_back("Water01.jpg");
53 texNames.push_back("Water02.jpg");
54 texNames.push_back("body.jpg");
55 texNames.push_back("stone1.jpg");
56 texNames.push_back("wall3.jpg");
57 texNames.push_back("sinbad_body.tga");
58 texNames.push_back("sinbad_clothes.tga");
59 texNames.push_back("stevecube_bk.jpg");
60
61 // create material and set the texture unit to our texture
62 MaterialPtr texArrayMat = MaterialManager::getSingleton().getByName("Examples/TextureArray", RGN_DEFAULT);
63 texArrayMat->compile();
64 Pass * pass = texArrayMat->getBestTechnique()->getPass(0);
65 pass->setLightingEnabled(false);
66 pass->createTextureUnitState()->setLayerArrayNames(TEX_TYPE_2D_ARRAY, texNames);
67
68 // create a plane with float3 tex coord - the third value will be the texture index in our case
69 ManualObject* textureArrayObject = mSceneMgr->createManualObject("TextureAtlasObject");
70
71 // create a quad that uses our material
72 int quadSize = 100;
73 textureArrayObject->begin(texArrayMat->getName(), RenderOperation::OT_TRIANGLE_LIST);
74 // triangle 0 of the quad
75 textureArrayObject->position(0, 0, 0);
76 textureArrayObject->textureCoord(0, 0, 0);
77 textureArrayObject->position(quadSize, 0, 0);
78 textureArrayObject->textureCoord(1, 0, 0);
79 textureArrayObject->position(quadSize, quadSize, 0);
80 textureArrayObject->textureCoord(1, 1, texNames.size());
81
82 // triangle 1 of the quad
83 textureArrayObject->position(0, 0, 0);
84 textureArrayObject->textureCoord(0, 0, 0);
85 textureArrayObject->position(quadSize, quadSize, 0);
86 textureArrayObject->textureCoord(1, 1, texNames.size());
87 textureArrayObject->position(0, quadSize, 0);

Callers

nothing calls this directly

Calls 15

setSkyBoxMethod · 0.80
setStyleMethod · 0.80
showCursorMethod · 0.80
getPassMethod · 0.80
getBestTechniqueMethod · 0.80
setLayerArrayNamesMethod · 0.80
createManualObjectMethod · 0.80
getRootSceneNodeMethod · 0.80
attachObjectMethod · 0.80
push_backMethod · 0.45
getByNameMethod · 0.45

Tested by

no test coverage detected