光源相关论文范文素材,与英语翻译书籍系列,张道真英语语法珍藏系列相关论文范文
本论文是一篇光源相关论文范文,关于英语翻译书籍系列,张道真英语语法珍藏系列相关电大毕业论文范文。免费优秀的关于光源及平面及什么是方面论文范文资料,适合光源论文写作的大学硕士及本科毕业论文开题报告范文和学术职称论文参考文献下载。
canunderstandandrenderitmosteffectively.Themostmonformtorepresent3Dmodelsinreal-timeapplicationis
triangles.Ourplanecanberepresentedusingtwotrianglestoformaquad.Withthesegment
optionforthex-andthey-axis,wecancontrolhowmanytrianglesaregeneratedforthe
plane.Inthefollowingimage,weseethetrianglesthatmakeuptheplanewithone,two,or
threesegmentsforeachaxis.Toseethiseffect,westarttheapplicationandthenpresstheR
key.Thiswillswitchtherenderingmodefirsttowireframemode,whereweseethetriangles.
Anotherkeypresswillchangethemodetopointmode,whereweseeonlythepointsofthe
triangles.Anotherpresswillsettherendermodetonormal.
【渲染一个3D的模型需要以某种计算机可以理解并且可以渲染的更有效率的描述方式.在实时程序中描述3D模型的最常见形式就是三角形.我们的平面可以用两个三角形可以组成一个四边形的方式来表示.因为切片的有X和Y轴的大小的平面参数,我们可以控制用多少三角形来生成一个平面.在下面的图片中,我们将会看到用每个轴一个,二个或者三个三角形切片组成平面.为看到这种效果,我们运行程序然后按下R键.这样就可以从第一渲染模式变为线框模式,这样我们就可以看到三角形了.再按一下R键将会改变现有模式为点模式,我们将会三角形的顶点了.再按一下R键将会改变为正常的渲染模式.】
该文网址 http://www.sxsky.net/xie/070878072.html
Afterwehavedefinedhowmanysegmentswewant,wepassaBooleanparameter
whichtellsOgre3Dthatwewantthenormaloftheplanetobecalculated.Assaidbefore,
anormalisavectorwhichstandsverticallyonthesurfaceoftheplane.Thenextthree
parametersareusedfortexturing.Totexturesomethingallpointsneedtexturecoordinates.
Texturecoordinatestelltherenderenginehowtomapthetextureontothetriangle.
Becauseapictureisa2Dsurface,thetexturecoordinatesalsoconsistoftwovalues,
namely,xandy.Theyarepresentedasatuple(x,y).Thevaluerangeoftexturecoordinates
isnormalizedfromzerotoone.(0,0)meanstheupper-leftcornerofthetextureand(1,1)
thebottom-rightcorner.Sometimesthevaluescanbegreaterthan1.Thismeansthatthe
texturecouldberepeateddependingonthesetmode.Thistopicwillbeexplainedinalater
chapterextensively.(2,2)couldrepeatthetexturetwiceacrossbothaxis.Thetenthand
eleventhparameterstellOgre3Dhowoftenwewantthetexturetobetiledacrosstheplane.
Theninthparameterdefineshowmanytextures'coordinateswewant.Thiscanbeuseful
whenworkingwithmorethanonetextureforonesurface.Thelastparameterdefinesthe
"up"directionforourtextures.Thisalsoaffectshowthetexturecoordinatesaregenerated.
Wesimplysaythatthez-axisshouldbe"up"forourplane.
【在定义完我们想要的切片的程度,我们传递一个布尔的参数来告诉Ogre3D平面的法向量是否被计算.正如之前所述,法向量是垂直于平面的一个向量.最后的那三个参数是作用用于纹理.渲染的纹理时,所有的点都需要纹理坐标.纹理坐标告诉渲染引擎如何映射材质到三角形.因为一张图片是一个2D的表面,纹理的坐标包含两个值即——x和y.它们被表示为一个数组(x,y).纹理坐标值正常初始化的范围为从0到1.(0,0)表示纹理的左上角,(1,1)表示为右下角.有时候它们的值会大于1,这表示纹理可以根据设置模式来进行重复.这个话题我们将在接下来的章节展开来谈.(2,2)可能表示纹理横跨两轴重复两次.第十和第十一个参数告诉Ogre3D我们想要纹理平铺平面的频率.第九个参数定义了我们需要多少个纹理坐标系.当我们使用超过1个的表面纹理的时候,这个参数就变的很有用了.最后一个参数定于了纹理"up"的方向.这也会影响到纹理坐标的生成.我们简单的说Z轴应"up"我们的平面.】
Instep4,wecreatedaninstanceoftheplanethatwejustcreatedwiththeMeshManager.
Todothis,weneedtousethenamewegavetheplaneduringcreation.Step5attachedthe
entitytothescene.
【在第四步,我们创建了一个刚经过MeshManage(网格管理器)创建的平面的实例.要做到这一点,我们需要使用在创建过程中我们给予平面的名称.在第五步中我们关联实体到场景.】
Instep6,wesetanewmaterialtotheinstanceoftheentity.Eachentityhasamaterial
assignedtoit.Thematerialdescribeswhichtexturetouse,howthelightinginteractswith
thematerial,andmuchmore.Wewilllearnaboutallofthisinthechapteronmaterials.
Theplanewecreateddoesn'thaveamaterialyetandthereforewouldberenderedwhite.
Becausewewanttoseetheeffectoflightswecreatelater,whiteisn'tthebestcolortouse.
Weusedamaterialthatisalreadydefinedinthemediafolder.Thismaterialsimplyaddsa
stonetexturetoourplane.
【在第六步中,我们设置了实体实例的一个新材质.每个实体会有一个材质分配给它.这个材质描述了我们使用的纹理与其所具有的光效果与材料的相互作用media文件夹下定义的材质.这个材质简单对我们的平面的添加了石头纹理.】
Addingapointlight
【添加一个点光源】
Nowthatwehavecreatedaplanetoseetheeffectthatthelighthasonourscene,weneedtoaddalighttoseesomething.
【现在我们已经创建了一个可以扎在我们场景中看见光源效果的平面,我们需要添加一个光源去看下效果.】
Timeforaction–addingapointlight
【实践时刻——添加一个点光源】
Wewillcreateapointlightandaddittoourscenetoseetheeffectithasonourscene:
【我们将会创建一个点光源并且添加到我们的场景中,然后观察光源在我们场景中的效果:】
Addthefollowingcodeaftersettingthematerialfortheplane:
【1.在设置完平面的材质之后添加以下代码:】
Ogre::SceneNode*node等于mSceneMgr->,createSceneNode("Node1"),
mSceneMgr->,getRootSceneNode()->,addChild(node),
CreatealightwiththenameLight1andtellOgre3Dit'sapointlight:
【2.创建一个名为Light1的光源并且告诉Ogre3D这是一个点光源:】
Ogre::Light*light1等于mSceneMgr->,createLight("Light1"),
light1->,setType(Ogre::Light::LT_POINT),
Setthelightcolorandposition:
【
光源相关论文范文素材,与英语翻译书籍系列,张道真英语语法珍藏系列相关论文范文参考文献资料: