对以前学习ogre做了一个简单的demo,在此作一些记录。
时间:2007.10~2007.12
【摘要】
1.使用了PagedGeomtry,OIS
2.参考render to tecture 制作了water reflection
3.使用CEGUI
4.制作了简单的Flare效果
5.为robot设计了简单的State machine:start->walk->attack->idle
【正文】
1.PagedGeomtry
2.水面反射
参考参考render to tecture demo,制作了water reflection 遗憾的是还没作出水面波动的效果。有时间的话要集成Hydrax :)。
3.flare
最初使用billboard实现flare,发现在camera移动过程中flare会抖动。(应该是渲染billboard的速度跟不上造成的),后来使用overlay实现flare,不会再出现抖动的现象了,效果如下。
a)
b)当太阳不在视野之外时,不显示flare
c)当太阳被物体遮挡时,不显示flare
未被遮挡时
遮挡时
another flare screenshot
4.state machine
(很想设计一个rts游戏,就从这些robot开始吧:) )
a)robot最初状态为idle
b) ogrehead标志鼠标点击的地点P,robot以P为攻击目标,朝向P,并向P移动。 当P在robot的攻击范围内时,则攻击。
朝向P
walking.....
Attack!
有一点比较有趣:
假设robot位置为Pr,robot转向向量(Pr->P)时,如果P和Pr不在一个水平面时,robot不会竖直状态。 如下设置,可以使robot保持竖直状态。
void DefaultStateActor::turnTo(const Ogre::Vector3 &targetPos) const {
this->mEntity->getParentSceneNode()->lookAt(
this->mTargetPos,
Ogre::Node::TS_WORLD,
Ogre::Vector3::UNIT_X);
this->mEntity->getParentSceneNode()->setDirection(
Ogre::Vector3::UNIT_Y ,
Ogre::Node::TS_WORLD,
Ogre::Vector3::UNIT_Y);
}
当然,也有其他方法,可以解决找个问题。
END.