OGRE中级教程六 Projective Decals

英语水平有限,欢迎大家批评指正微笑

本文并没有将原文全部翻译,只是将其中的一些知识点翻译总结了一下,想要查看详细讲解的话,可以到原文处看一下,附上英文原文地址:http://www.ogre3d.org/tikiwiki/tiki-index.php?page=Intermediate+Tutorial+6&structure=Tutorials

Introduction

   本教程中我们将学习如何给场景中的对象添加射影贴花(projective decals 映射贴图?)。当你想要做一些诸如一个选择指示器、一个投影出你所瞄准的东西的瞄准景象或一些投影到某些东西上的其他类型的贴花,投影纹理是很有用的。

Projective Decals

Frustums

   A frustum represents a pyramid capped at a the near and far end, which represents a visible area or a projection. OGRE用它来表示摄像机(Camera类直接继承自Frustum类)。本教程中我们要使用一个frustum来投射贴花到场景中的网格。

   创建投影仪(projector)的第一件事是创建代表投影仪的frustum,并把它绑定到一个场景节点上。添加如下代码到creatProjector中:

    mDecalFrustum = new Ogre::Frustum();

mProjectorNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("DecalProjectorNode");

mProjectorNode->attachObject(mDecalFrustum);

mProjectorNode->setPosition(0,5,0);

   这段代码创建了一个投影仪(projector),当你离它越来越远它就会种植(grow)贴花,很像一台电影投影仪一样。如果你想要创建一个投影仪(projector)来维持一个与距离无关的大小和形状不变的贴花,添加如下代码(本教程中不使用):

    // Do not add this to the project

mDecalFrustum->setProjectionType(Ogre::PT_ORTHOGRAPHIC);

mDecalFrustum->setOrthoWindowHeight(100);

   setOrthoWindowHeight()使用方向比率(aspect ratio)设置一个orthographic frustum的大小。

Before continuing, please take note of where our frustum is projecting the decal. In this application there is a ring of Ogre heads and the frustum sits in the dead center of them (though shifted up slightly, by 5 units), pointed in the -Z direction (which is the default since we did not change the orientation). This means that, eventually, when we run the application decals will be projected onto the back Ogre heads.

Modifying the Material

   为了使贴花(decal)真正的出现在对象上,他使用的材质需要接收贴花。(未完待续。。。)

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值