OGRE Demo_EnvMapping
来源:互联网 发布:深度解析淘宝运营 pdf 编辑:程序博客网 时间:2024/05/17 01:54
截图:
参考对比下纯D3D的实现:《精通DirectX 3D》第十二章 高级纹理应用 06_SphericalEnvMapping
原理都是一样的,都是有个环境贴图,假的环境映射!
实现很简单,override createScene成员函数就可以了
// Just override the mandatory create scene method
void createScene(void)
{
// Set ambient light
mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5));
// Create a point light
Light* l = mSceneMgr->createLight("MainLight");
// Accept default settings: point light, white diffuse, just set position
// NB I could attach the light to a SceneNode if I wanted it to move automatically with
// other objects, but I don't
l->setPosition(20,80,50);
Entity *ent = mSceneMgr->createEntity("head", "ogrehead.mesh");
// Set material loaded from Example.material
ent->setMaterialName("Examples/EnvMappedRustySteel");
// Add entity to the root scene node
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(ent);
}
void createScene(void)
{
// Set ambient light
mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5));
// Create a point light
Light* l = mSceneMgr->createLight("MainLight");
// Accept default settings: point light, white diffuse, just set position
// NB I could attach the light to a SceneNode if I wanted it to move automatically with
// other objects, but I don't
l->setPosition(20,80,50);
Entity *ent = mSceneMgr->createEntity("head", "ogrehead.mesh");
// Set material loaded from Example.material
ent->setMaterialName("Examples/EnvMappedRustySteel");
// Add entity to the root scene node
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(ent);
}
对应的材质脚本在
ogrenew/Samples/Media/materials/scripts/Example.material
里,如下:
material Examples/EnvMappedRustySteel
{
technique
{
pass
{
texture_unit
{
texture RustySteel.jpg
}
texture_unit
{
texture spheremap.png
colour_op_ex add src_texture src_current
colour_op_multipass_fallback one one
env_map spherical // hew:这里指明环境映射的类型是球形环境映射
}
}
}
}
{
technique
{
pass
{
texture_unit
{
texture RustySteel.jpg
}
texture_unit
{
texture spheremap.png
colour_op_ex add src_texture src_current
colour_op_multipass_fallback one one
env_map spherical // hew:这里指明环境映射的类型是球形环境映射
}
}
}
}
ogrenew/Samples/Media/materials/textures/spheremap.png
ogrenew/Samples/Media/materials/textures/RustySteel.jpg
- OGRE Demo_EnvMapping
- OGRE Demo_EnvMapping
- Ogre
- ogre
- OGRE
- OGRE
- ogre
- OGRE
- ogre
- OGER SDK研究之二 Demo_EnvMapping 环境映射
- OGRE乱记二
- OGRE乱记三
- 关于OGRE
- 学习OGRE~~
- Ogre介绍
- Ogre网站
- ogre+mfc
- 学习Ogre
- java 实现查询一个数据表中记录总数
- OGRE Demo_RenderToTexture 渲染到纹理
- Android uses-permission 配置详解
- Mysql跨库入侵介绍
- 转过来,我马上要用了,嘿嘿----js和css制作简单的文字闪烁效果
- OGRE Demo_EnvMapping
- 如何使用Jprofiler工具进行内存检测
- Java线程的概念
- WM_CREATE和WM_INITDIALOG消息响应函数之区别,以及MFC应用程序中处理消息的...
- pku acm 1018
- web安全设置和目录权限设置介绍
- 推荐11本对程序员最有影响力的书籍
- Android2.2完全退出程序
- 【Android开篇】开始 Hello Android