Ogitor 场景编辑器之贴花
2010-03-18 16:23
267 查看
创建
设置
] mDecal = Ogitors::OgitorsRoot::getSingletonPtr()->GetSceneManager()->createManualObject(sName); mDecal->setCastShadows(false); mDecal->setDynamic(true); mDecal->setRenderQueueGroup(RENDER_QUEUE_WORLD_GEOMETRY_2); if (uShapeFlag == RenderOperation::OT_TRIANGLE_LIST) { int x_size = 4; int z_size = 4; mDecal->begin("Decal" , RenderOperation::OT_TRIANGLE_LIST); for (int i=0; i<x_size; i++) { for (int j=0; j<=z_size; j++) { mDecal->position(Ogre::Vector3(i, 0, j)); mDecal->textureCoord((float)i / (float)x_size, (float)j / (float)z_size); } } for (int i=0; i<x_size; i++) { for (int j=0; j<z_size; j++) { mDecal->quad( i * (x_size+1) + j, i * (x_size+1) + j + 1, (i + 1) * (x_size+1) + j + 1,(i + 1) * (x_size+1) + j); } } mDecal->end(); } Ogitors::OgitorsRoot::getSingletonPtr()->GetSceneManager()->getRootSceneNode()->createChildSceneNode()->attachObject(mDecal);
设置
] int x_size = 4; int z_size = 4; float radius = 1.57f; float offset = 0.2f; mDecal->beginUpdate(0); if ( mPositions.size() > 0) { float x = mPositions[0].x; float y = mPositions[0].y; float z = mPositions[0].z; Ogre::Real x1 = x - radius; Ogre::Real z1 = z - radius; Ogre::Real x_step = radius * 2/ x_size; Ogre::Real z_step = radius * 2/ z_size; for (int i=0; i<=x_size; i++) { for (int j=0; j<=z_size; j++) { mDecal->position(Ogre::Vector3(x1, OgitorsRoot::getSingletonPtr()->getTerrainHeight(x1, z1) + offset, z1)); mDecal->textureCoord((float)i / (float)x_size, (float)j / (float)z_size); z1 += z_step; } x1 += x_step; z1 = z - radius; } for (int i=0; i<x_size; i++) { for (int j=0; j<z_size; j++) { mDecal->quad( i * (x_size+1) + j, i * (x_size+1) + j + 1, (i + 1) * (x_size+1) + j + 1, (i + 1) * (x_size+1) + j); } } } mDecal->end();
相关文章推荐
- Ogre场景编辑器Ogitor
- Ogre场景编辑器Ogitor源代码的构建
- Ogre场景编辑器Ogitor的使用总结
- Ogre场景编辑器Ogitor源代码的构建
- Ogre场景编辑器Ogitor源代码的构建
- Ogre场景编辑器Ogitor的使用总结
- Ogre场景编辑器Ogitor
- Silverlight游戏设计(Game Design):(六)场景编辑器之开源畅想
- Silverlight游戏设计(Game Design):(七)创建基于场景编辑器的新游戏Demo
- Cocos2d-x 3.0 开发(十)使用CocoStudio场景编辑器关联组件
- Unity3D 场景编辑器扩展学习笔记-Handles&Event
- CocoStudio基础教程(5)使用CocoStudio场景编辑器关联组件
- Unity编辑器重写Inspector面板,面板中编辑的数据不触发场景发生变化的问题。
- 郁闷的BUG(在编辑器运行正常,在手机上只有场景显示)
- Silverlight游戏设计(Game Design):(六)场景编辑器之开源畅想
- 贴花编辑器实现细节
- Cocos2d场景编辑器CocosBuilder使用教程
- unity编辑器拓展四——删除场景空Animator组件
- Silverlight游戏设计(Game Design):(六)场景编辑器之开源畅想
- 使用Ogitor自带的场景