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

Method setupContent

Samples/ShaderSystem/src/ShaderSystem.cpp:220–361  ·  view source on GitHub ↗

-----------------------------------------------------------------------

Source from the content-addressed store, hash-verified

218
219//-----------------------------------------------------------------------
220void Sample_ShaderSystem::setupContent()
221{
222 mTextureAtlasFactory.reset(new TextureAtlasSamplerFactory);
223 mShaderGenerator->addSubRenderStateFactory(mTextureAtlasFactory.get());
224
225 mInstancedViewportsFactory.reset(new ShaderExInstancedViewportsFactory);
226 mShaderGenerator->addSubRenderStateFactory(mInstancedViewportsFactory.get());
227
228 // Setup default effects values.
229 mCurLightingModel = SSLM_PerPixelLighting;
230 mPerPixelFogEnable = false;
231 mSpecularEnable = false;
232 mReflectionMapSubRS = NULL;
233 mLayerBlendSubRS = NULL;
234
235 mRayQuery = mSceneMgr->createRayQuery(Ray());
236 mTargetObj = NULL;
237
238
239 // Set ambient lighting.
240 mSceneMgr->setAmbientLight(ColourValue(0.2, 0.2, 0.2));
241
242 // Setup the sky box,
243 mSceneMgr->setSkyBox(true, "Examples/SceneSkyBox2");
244
245 MeshManager::getSingleton().createPlane("Myplane",
246 ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Plane(Vector3::UNIT_Y, 0),
247 1500,1500,25,25,true,1,60,60,Vector3::UNIT_Z);
248
249 Entity* pPlaneEnt = mSceneMgr->createEntity( "plane", "Myplane" );
250 pPlaneEnt->setMaterialName("Examples/Rockwall");
251 pPlaneEnt->setCastShadows(false);
252 mSceneMgr->getRootSceneNode()->createChildSceneNode(Vector3(0,0,0))->attachObject(pPlaneEnt);
253
254 mCamera->setNearClipDistance(30);
255
256 // Load sample meshes and generate tangent vectors.
257 for (const auto & curMeshName : MESH_ARRAY)
258 {
259 MeshPtr pMesh = MeshManager::getSingleton().load(curMeshName,
260 ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
261 HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY,
262 HardwareBuffer::HBU_STATIC_WRITE_ONLY,
263 true, true); //so we can still read it
264
265 // Build tangent vectors, all our meshes use only 1 texture coordset
266 pMesh->buildTangentVectors();
267 }
268
269
270
271 Entity* entity;
272 SceneNode* childNode;
273
274 // Create the main entity and mark it as the current target object.
275 entity = mSceneMgr->createEntity(MAIN_ENTITY_NAME, MAIN_ENTITY_MESH);
276 mTargetEntities.push_back(entity);
277 childNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();

Callers

nothing calls this directly

Calls 15

Vector3Class · 0.85
Vector4fClass · 0.85
setSkyBoxMethod · 0.80
createEntityMethod · 0.80
attachObjectMethod · 0.80
getRootSceneNodeMethod · 0.80
setNearClipDistanceMethod · 0.80
buildTangentVectorsMethod · 0.80
getMaterialMethod · 0.80
getSubEntityMethod · 0.80
getEntityMethod · 0.80

Tested by

no test coverage detected