光源相关论文范文素材,与英语翻译书籍系列,张道真英语语法珍藏系列相关论文范文
本论文是一篇光源相关论文范文,关于英语翻译书籍系列,张道真英语语法珍藏系列相关电大毕业论文范文。免费优秀的关于光源及平面及什么是方面论文范文资料,适合光源论文写作的大学硕士及本科毕业论文开题报告范文和学术职称论文参考文献下载。
ositionitinsuchawaythatthecirclesofbothspotlightsoverlapeachotherabit.Youshouldseethatthecolorismixingintheareawherethegreenandredlightoverlap.【创建与第一个聚光源位置不同的第二个聚光源,给第二个聚光源以红色的光线,以如此方式安置光源,可以使两个聚光源重叠一部分.你就可以看到在绿色和红色的重叠区域会有颜色的混合.】
Directionallights
【方向光源】
Wehavecreatedspotlightsandpointlights.Nowwearegoingtocreatethelastlighttype—directionallights.Adirectionallightisalightthatisfarawayandonlyhasadirectionandacolor,butnolightconeorradiuslikespotlightsorpointlights.Itcanbethoughtofasthesun.Forus,thesunlightesfromonedirection,thedirectionofthesun.
【我们已经创建过了聚光源和点光源.现在我们准备创建最后一种光源类型——方向光源.方向光源是一种离你很远的光源而且这种光只有方向和颜色,但是却没有像聚光源和点光源的锥形光束光照范围Timeforaction–creatingadirectionallight
【实践时刻——创建一个方向光源】
1.DeletealltheoldcodeincreateScene(),exceptfortheplane-relatedcode.
【1.除了与平面相关的代码,删除所有的createScene()函数中的旧代码.】
Createalightandsetthelighttypetodirectionallight:
【2.创建一个光源并且设置光源的类型为方向光源:】
Ogre::Light*light等于mSceneMgr->,createLight("Light1"),
light->,setType(Ogre::Light::LT_DIRECTIONAL),
Setthelighttoawhitecolorandthelightdirectiontoshineinadown-rightdirection:
【设置光源为白色并且设置光源的方向为右下方.】
light->,setDiffuseColour(Ogre::ColourValue(1.0f,1.0f,1.0f)),
light->,setDirection(Ogre::Vector3(1,-1,0)),
Compileandruntheapplication.
【编译运行程序.】
Whatjusthappened
【刚刚发生了什么】
Wecreatedadirectionallightandsetittoshinedownandrightwardswith
setDirection(1,-1,0).Inthepreviousexamples,wealwayshadaratherblackplane
andasmallpartoftheplanewasilluminatedbyourpointlightorspotlight.Here,weused
adirectionallightandhencethepleteplaneisilluminated.Assaidbefore,adirectional
lightcanbethoughtofasthesun,andthesundoesn'thaveafalloffradiusoranythingelse.Sowhenitshines,itilluminateseverythingthereis,thesameistrueforourdirectionallight.
【我们创建了一个方向光源并且使用setDirection(1,-1,0)设置它发光的方向是右下.在之前的例子中,我们创建的平面几乎是黑色并且平面只有一小部分被点光源或聚光源所照亮.这里,我们使用了一个方向光源,这以后整个平面被照亮了.正如前面所述,方向光源可以认为是一个太阳,太阳发出的光是没有衰减半径,也没有别的特殊性质.所以当太阳发光的时候,它会照亮所有的物体.这对我们的方向光源同样适用.】
Popquiz–differentlighttypes
【简单测试——不同的光源类型】
RecallallthreelighttypesthatOgre3Dhasandstatethedifferences.
【回忆Ogre3D中的三种光源类型并且说明之间的不同】
Themissingthing
【遗漏的东西】
Wealreadyhaveaddedlighttoourscene,butsomethingismissing.What'smissingwillbe
showninthenextexample.
【我们已经添加光源到我们的场景中,但是却遗漏了一些东西.在下个例子中我们将会显示出到底是遗漏了什么.】
Timeforaction–findingoutwhat'smissing
【实践时刻——找出到底遗漏了什么】
Weareusingthepreviouslysuggestedcodetofindoutwhatismissinginourscene.
【我们使用之前推荐的代码来找出在场景中遗漏了什么东西.】
1.Afterthecreationofthelight,addcodetocreateaninstanceofSinbad.meshand
alsocreateanodeandattachthemodeltoit:
【1.在创建光源完成后,添加代码以创建一个Sinbad.mesh的实例并创建一个节点用以关联模型.】
Ogre::Entity*Sinbad等于mSceneMgr->,createEntity("Sinbad","Sinbad.mesh"),
Ogre::SceneNode*SinbadNode等于node->,createChildSceneNode("SinbadNode"),
2.ThenscaleSinbadtothreetimeshissizeandmovehimabitupwards,otherwise,he
willbestuckintheplane.Alsoaddhimtothescenenode,sohewillberendered:
【2.然后按三倍的大小来设置Sinabad的缩放比例,并把它稍往上移动一点.否则,它将卡在平面上.同样的,添加它到场景,这样它就可以被渲染了.】
SinbadNode->,setScale(3.0f,3.0f,3.0f),
SinbadNode->,setPosition(Ogre::Vector3(0.0f,4.0f,0.0f)),
SinbadNode->,attachObject(Sinbad),
Compileandruntheapplication.
【4.编译运行程序.】
Whatjusthappened
【刚刚发生了什么】
WeaddedaninstanceofSinbadintoourscene.Oursceneisstilllit,butweseethatSinbad
doesn'tthrowashadow,whichisratherunrealistic.Thenextstepistoaddshadowsto
ourscene.
【我们在场景中添加了一个Sinbad的实例.我们的场景仍然是发亮的,但是我们看到Sinbad却不投射出影子,这就相当的不切实际了.下一步就是添加阴影到我们的场景.】
Addingshadows
【添加阴影】
Withoutshadows,a3Dsceneisn'treallyplete,solet'saddthem.
【一个没有阴影的3D场景不是真正完整的3D场景.因此,让我们添加它们】
Timeforaction–addingshadows
【实践时刻】
Usethepreviouslyusedcode.
【使用之前已使用过的代码】
1.AfteraddingalltheothercodeinthecreateScene()function,addthe
followingline:
【1.在createScene()函数中现存的代码之后添加以下一行:】
mSceneMgr->,setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_ADDITIVE),
Compileandruntheapplication.
【2.编译运行程序.】
Whatjusthappened
【刚刚发生了什么】
Withjustoneline,weaddedshadowstoourscene.Ogre3Ddoestherestofthework
forus.Ogre3Dsupportsdifferentshadowtechniques.Weusedadditivestencilshadows.
Stencilmeansaspecialtexturebufferusedwhilerenderingthescene.
【用了刚才的一行代码,我们添加阴影到我们的场景之中.Ogre3D为我们做了在剩下的工作additivestencilshadows.Stencil意思是指,当渲染场景时,使用的一种特殊
光源相关论文范文素材,与英语翻译书籍系列,张道真英语语法珍藏系列相关论文范文参考文献资料: