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

Function createMeshWithMaterial

Tests/OgreMain/src/MeshWithoutIndexDataTests.cpp:271–329  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

269}
270//--------------------------------------------------------------------------
271static void createMeshWithMaterial(const String& fileName)
272{
273 String matFileNameSuffix = ".material";
274 String matName1 = "red";
275 String matFileName1 = matName1 + matFileNameSuffix;
276 MaterialPtr matPtr = MaterialManager::getSingleton().create(matName1, "General");
277 Pass* pass = matPtr->getTechnique(0)->getPass(0);
278 pass->setDiffuse(1.0, 0.1, 0.1, 0);
279
280 String matName2 = "green";
281 String matFileName2 = matName2 + matFileNameSuffix;
282 matPtr = MaterialManager::getSingleton().create(matName2, "General");
283 pass = matPtr->getTechnique(0)->getPass(0);
284 pass->setDiffuse(0.1, 1.0, 0.1, 0);
285
286 String matName3 = "blue";
287 String matFileName3 = matName3 + matFileNameSuffix;
288 matPtr = MaterialManager::getSingleton().create(matName3, "General");
289 pass = matPtr->getTechnique(0)->getPass(0);
290 pass->setDiffuse(0.1, 0.1, 1.0, 0);
291
292 String matName4 = "yellow";
293 String matFileName4 = matName4 + matFileNameSuffix;
294 matPtr = MaterialManager::getSingleton().create(matName4, "General");
295 pass = matPtr->getTechnique(0)->getPass(0);
296 pass->setDiffuse(1.0, 1.0, 0.1, 0);
297
298 ManualObject* manObj = OGRE_NEW ManualObject("mesh");
299 manObj->begin(matName1, RenderOperation::OT_TRIANGLE_LIST);
300 manObj->position(0, 50, 0);
301 manObj->position(50, 50, 0);
302 manObj->position(0, 100, 0);
303 manObj->triangle(0, 1, 2);
304 manObj->position(50, 100, 0);
305 manObj->position(0, 100, 0);
306 manObj->position(50, 50, 0);
307 manObj->triangle(3, 4, 5);
308 manObj->end();
309 manObj->begin(matName2, RenderOperation::OT_LINE_LIST);
310 manObj->position(0, 100, 0);
311 manObj->position(-50, 50, 0);
312 manObj->position(-50, 0, 0);
313 manObj->position(-50, 50, 0);
314 manObj->position(-100, 0, 0);
315 manObj->position(-50, 0, 0);
316 manObj->end();
317 manObj->begin(matName3, RenderOperation::OT_LINE_STRIP);
318 manObj->position(50, 100, 0);
319 manObj->position(100, 50, 0);
320 manObj->position(100, 0, 0);
321 manObj->position(150, 0, 0);
322 manObj->end();
323 manObj->begin(matName4, RenderOperation::OT_POINT_LIST);
324 manObj->position(50, 0, 0);
325 manObj->position(0, 0, 0);
326 manObj->end();
327 manObj->convertToMesh(fileName);
328 OGRE_DELETE manObj;

Callers 1

TEST_FFunction · 0.85

Calls 8

ManualObjectClass · 0.85
getPassMethod · 0.80
convertToMeshMethod · 0.80
createMethod · 0.45
getTechniqueMethod · 0.45
setDiffuseMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected