+ | _mf : _ModelFactory |
程序开始时自动创建。脚本中应该使用此对象。 示例
|
+ | ImageBmp : uint |
BMP图像。 |
+ | ImageDds : uint |
DDS图像。 |
+ | ImageGif : uint |
GIF图像。 |
+ | ImageJpg : uint |
JPG图像。 |
+ | ImagePng : uint |
PNG图像。 |
+ | ImageTga : uint |
TGA图像。 |
+ | ImageTiff : uint |
TIFF图像。 |
+ | function _ModelFactory() : _ModelFactory |
示例
|
+ | function addImageHeader(resname: string, width: int, height: int) |
在图片文件附加一个长宽值,当作图片的原始尺寸。
|
+ | function buildAnimaTexture(srcname:string, desname:string, interval:uint, row:uint, column:uint, num:uint) |
合成序列图。
示例
|
+ | function buildAnimaTexture(srcnames:string[], desname:string, interval:uint) |
合成序列图。
示例
|
+ | function buildSkeletonBoundSphere(sklname: string, sknname: string) |
用于给骨骼增加Bound Sphere,应用到骨骼碰撞的项目可以在出版的时候调用该接口在骨骼文件中直接增加碰撞信息,之后就不需要用到碰撞蒙皮文件了。
|
+ | function changeImageFormat(srcname : string, desname : string, format : uint, quality : uint) |
转换图片格式。
|
+ | function changeImagesFormat(srcnames : string [], format : uint, quality : uint) |
转换图片格式。
|
+ | function checkAnimation(filename : string) |
将tag文件的信息合并到动画文件中。
|
+ | function checkModel(filename : string) |
压缩旧版的mesh文件。
|
+ | function checkTerrain(filename : string, layerfile : bool) |
将旧版的ten文件或者sen文件转为新版。
|
+ | function createCone() : _Mesh |
创建圆锥体模型。 |
+ | function createCube() : _Mesh |
创建立方体模型。 |
+ | function createCylinder() : _Mesh |
创建圆柱体模型。 |
+ | function createHemiSphere() : _Mesh |
创建半球模型。 |
+ | function createPlane() : _Mesh |
创建平面模型。 |
+ | function createPyramid() : _Mesh |
创建角锥模型。 |
+ | function createSphere() : _Mesh |
创建球体模型。 |
+ | function createTeapot() : _Mesh |
创建茶壶模型。 |
+ | function cutImage(srcname : string, desname : string, x : uint, y : uint, w : uint, h : uint) |
分割图片。
|
+ | function isAlphaImage(resname : string) : bool |
判断一个图片文件是否带alpha通道。
|
+ | function isSolidColorImage( resname : string ) : bool |
判断图片是否是纯色图片。
|
+ | function loadSpeed(resname : string) : number |
从文件读取模型的speed数据。
|
+ | function optimizeAlphaImage(srcname: string, desname: string) |
优化alpha通道全为1的32位图片。
|
+ | function optimizeMesh(srcname : string, desname : string ) : bool |
用于减少模型顶点色,提高渲染效率,压缩文件大小。
|
+ | function optimizeSkeletonAnimation(srcname : string, desname : string ) : bool |
用于减少骨骼动画冗余关键帧,压缩文件大小。
|
+ | function paintDiffuse( msh : _Mesh, color : _uint ) |
设定模型的漫反射颜色。
示例
|
+ | function paintSpecular( msh : _Mesh, color : _uint ) |
设定模型的镜面反射颜色。
示例
|
+ | function resizeImage(srcname : string, desname : string, wratio: float, hratio: float) |
转换图片格式。
|
+ | function resizeImagePowerOfTwo(srcname: string, desname: string[, square : bool]) |
把图片拉伸到最近的2的幂。
|
+ | function resizeImages(srcname : string [], wratio: float, hratio: float) |
转换图片格式。
|
+ | function saveSpeed(resname : string, s : number) |
保存模型的speed数据到文件。
|
对模型进行变换。
示例
|
对模型使用的纹理进行变换。
|
_sys:addPath('res')_dofile('cameracontrol.lua')_rd.camera.eye = _Vector3.new(5, 5, 5)_rd:useLight(_AmbientLight.new())_rd:useLight(_SkyLight.new())meshs = {}meshs.Cube = _mf:createCube()meshs.Pyramid = _mf:createPyramid()meshs.Sphere = _mf:createSphere()meshs.Cylinder = _mf:createCylinder()meshs.Cone = _mf:createCone()meshs.Teapot = _mf:createTeapot()meshs.Plane = _mf:createPlane()curMesh = meshs.CubetextureFlag = truefunction newt() if textureFlag then curMesh:setTexture(_Image.new('stone_color.jpg')) else curMesh:setTexture() endendnewt()_app:onKeyDown(function(key) if key == _System.Key1 then curMesh = meshs.Cube newt() elseif key == _System.Key2 then curMesh = meshs.Pyramid newt() elseif key == _System.Key3 then curMesh = meshs.Sphere newt() elseif key == _System.Key4 then curMesh = meshs.Cylinder newt() elseif key == _System.Key5 then curMesh = meshs.Cone newt() elseif key == _System.Key6 then curMesh = meshs.Teapot newt() elseif key == _System.Key7 then curMesh = meshs.Plane newt() elseif key == _System.KeySpace then if textureFlag then textureFlag = false else textureFlag = true end newt() endend)noticefont = _Font.new('Arial', 10)noticefont.textColor = _Color.Yellow_app:onIdle(function(e) noticefont:drawText(0, 0, 'Press 1 to draw a Cube') noticefont:drawText(0, 14, 'Press 2 to draw a Pyramid') noticefont:drawText(0, 28, 'Press 3 to draw a Sphere') noticefont:drawText(0, 42, 'Press 4 to draw a Cylinder') noticefont:drawText(0, 56, 'Press 5 to draw a Cone') noticefont:drawText(0, 70, 'Press 6 to draw a Teapot') noticefont:drawText(0, 84, 'Press 7 to draw a Plane') noticefont:drawText(0, 98, 'Press space to draw texture') curMesh:drawMesh() _rd:drawAxis(2)end)