+ | _rd : _RenderDevice |
程序开始时自动创建。脚本中应该使用此对象。 |
+ | cx1 : number |
渲染设备左上顶点坐标x值
|
+ | cx2 : number |
渲染设备右下顶点坐标x值
|
+ | cy1 : number |
渲染设备左上顶点坐标y值
|
+ | cy2 : number |
渲染设备右下顶点坐标y值
|
+ | font : _Font |
渲染设备默认字体
|
+ | lost : bool |
渲染设备是否丢失
|
+ | shadowMap : _Image |
渲染设备阴影贴图
|
+ | x : number |
渲染设备宽长
|
+ | y : number |
渲染设备高度
|
+ | MiniPolygonHide : uint |
mini模型flag之隐藏小模型
|
+ | MiniPolygonNormal : uint |
mini模型flag之正常模式
|
+ | MiniPolygonOnly : uint |
mini模型flag之只显示小模型
|
+ | PixelLighting : uint |
像素光照
|
+ | ShadowMap1 : uint |
阴影模式1
|
+ | ShadowMap2 : uint |
阴影模式2
|
+ | ShadowMap3: uint |
阴影模式3
|
+ | ShadowMap4 : uint |
阴影模式4
|
+ | ShadowVolume : uint |
区别于shadowMap的阴影模式
|
+ | VertexLighting : uint |
顶点光照
|
+ | animaBlendTime : uint |
动画混合时间。
|
+ | balanceColor: uint |
白平衡颜色。默认值为白色(0xFFFFFFFF)。
|
+ | bgColor : uint |
背景颜色。
|
+ | blockColor : uint |
半透明遮挡时的颜色。
|
+ | blockee : bool |
半透明遮挡。
|
+ | blocker : bool |
遮挡。
|
+ | blockQuality : number |
遮挡质量。
|
+ | boneBlendTime : uint |
骨头混合时间。
|
+ | camera : _Camera |
当前摄像机。
|
+ | colorGradingLUT : _Image |
调色的颜色查找表。
|
+ | dummyMesh : _Mesh |
设置场景中lowRenderPriorty的结点达到上限后替换的渲染Mesh。
|
+ | edge : bool |
是否描边。
|
+ | edgeColor : uint |
描边使用的颜色。
|
+ | edgeQuality : number |
描边质量,默认值是1.0。
|
+ | glowFactor : number |
亮度。数值为[0, 1], 默认值为0。
|
+ | h : int |
渲染设备的高度。
|
+ | hdr: bool |
HDR效果。
|
+ | hdrAdaptionSpeed: number |
人眼适应速度,默认值是30。
|
+ | hdrBloomIntensity: number |
泛光强度。
|
+ | hdrBloomSize1 : number |
泛光内光圈大小。
|
+ | hdrBloomSize2 : number |
泛光中间光圈大小。
|
+ | hdrBloomSize3 : number |
泛光外光圈大小。
|
+ | hdrBrightThreshold: number |
亮度阈值。默认值为5.0。
|
+ | hdrDebug: bool |
Debug HDR。
|
+ | hdrFactor: number |
HDR影响因子。范围为[0, 1]。]默认值为1.0。
|
+ | hdrGamma: number |
Gamma矫正。
|
+ | hdrLimit: number |
亮度下限。默认值是0.1。
|
+ | hdrQuick: bool |
快速HDR。
|
+ | lightFactor : number |
受光系数。
|
+ | lightMode : uint |
光照模式。
|
+ | lodDistance : number |
设置lod距离。
|
+ | miniPolygonFlag : uint |
小模型flag。
|
+ | mip : bool |
纹理采样时是否使用mip信息。
|
+ | mipAutoGen : bool |
是否自动生成mip信息。
|
+ | MSAA : bool |
IOS端是否开启多重采样抗锯齿。
|
+ | pfxBrightness : number |
特效亮度。
|
+ | saturation : number |
对比度。范围为[0, 1]。默认为1。
|
+ | screenBlender : _Blender |
用于做屏幕特效。 |
+ | shadowCaster : bool |
渲染物是否投射阴影。
|
+ | shadowColor : uint |
阴影颜色。默认值为0(黑色)。
|
+ | shadowLength : number |
阴影的最大长度。默认值为100.0。
|
+ | shadowLight : _Vector3 |
投射阴影的光的方向,默认值为(0, 0, -1)。
|
+ | shadowMapSize : uint |
用来设置阴影贴图的尺寸,默认值为1024。
|
+ | shadowMode : uint |
阴影Mode, 默认_rd.shadowMode = 0, 这时的shadow无锯齿,是唯一可以指定color的shadow,不过caster数量较多时比较耗费性能。 _rd.shadowMode也可直接赋值为1~4,这种shadow有锯齿,效果↑ 性能↓,当摄像机为平视的时候效果不好,reciver数量较多时比较耗费性能。 _rd.shadowMode = 5时,给平坦地形做了优化 提高性能和质量
|
+ | shadowQuality : number |
阴影质量。取值范围为[0,1]。
|
+ | shadowReceiver : bool |
渲染物是否被投上阴影。
|
+ | texSampler : uint |
贴图采样。有 RenderDevice.LinearTexSampler, RenderDevice.NearestTexSampler两种
|
+ | toonColor : uint |
卡通描边的颜色。
|
+ | toonQuality : number |
卡通描边质量,用于控制描边的宽度,取值0-1,为0时取消描边。
|
+ | toonStep : uint |
卡通光照颜色阶数,大于0时有效,为0时取消卡通光照。
|
+ | vignetteFactor : number |
晕影亮度系数。
|
+ | vignetteImage : _Image |
图片对象,用作晕影贴图。
|
+ | vignetteOffset : number |
晕影亮度偏移。
|
+ | vignettePow : number |
晕影亮度指数。
|
+ | vignetteWeight : number |
晕影贴图与背景混合系数。
|
+ | w : int |
渲染设备的宽度。
|
+ | wireframe : bool |
线框模式。
|
+ | function _RenderDevice() : _RenderDevice |
|
+ | function buildRay(x : int, y : int) : object |
从屏幕上的点(x, y)创建pick用的射线。
|
+ | function cleanRect(x1 : int, y1 : int, x2 : int, y2 : int) |
清空矩形范围。
|
+ | function draw3DCircle(x1 : number, y1 : number, z1 : number, x2 : number, y2 : number, z2 : number, radius : number, segment : uint, color : uint) |
画3D的圆。
|
+ | function draw3DLine(x1 : number, y1 : number, z1 : number, x2 : number, y2 : number, z2 : number, color : uint) |
画3D线。
|
+ | function draw3DPoint(x : number, y : number, z : float, color : uint) |
画3D点。
|
+ | function draw3DRect(x1 : number, y1 : number, z1 : number, x2 : number, y2 : number, z2 : number, x3 : number, y3 : number, z3 : number, color : number) |
画3d矩形。
|
+ | function draw3DTriangle(x1 : number, y1 : number, z1 : number, x2 : number, y2 : number, z2 : number, x3 : number, y3 : number, z3 : number, color : uint) |
画3D三角形。
|
+ | function drawAxis(length : number) |
画坐标轴。
|
+ | function drawLine(x1 : int, y1 : int, x2 : int, y2 : int, color : uint) |
画线。
|
+ | function drawPoint(x : int, y : int, color : uint) |
画点。
|
+ | function drawPolygon(pointArray : array) |
画多边形。
|
+ | function drawRect(x1 : int, y1 : int, x2 : int, y2 : int, color : uint) |
画矩形。
|
+ | function drawTriangle(x1 : int, y1 : int, x2 : int, y2 : int, x3 : int, y3 : int, color : uint) |
画三角形。
|
+ | function fillPolygon(pointArray : array) |
填充多边形。
|
+ | function fillRect(x1 : int, y1 : int, x2 : int, y2 : int, color : uint) |
填充矩形。
|
+ | function fillTriangle(x1 : int, y1 : int, x2 : int, y2 : int, x3 : int, y3 : int, color : uint) |
填充三角形。
|
从屏幕上的点(x, y) pick平面Z = p的结果。 |
从屏幕上的点(x, y) pick平面Y = p的结果。 |
从屏幕上的点(x, y) pick平面X = p的结果。 |
+ | function pop2DMatrix(mat : _Matrix2D) |
将_Matrix2D栈的栈顶元素弹出。每个或应该对应一个push2DMatrix。 |
+ | function pop3DMatrix() |
将渲染设备的_Matrix3D栈的栈顶元素弹出。每个或应该对应一个push3DMatrix。 |
+ | function popBlender() |
渲染设备的_Blender栈的栈顶元素弹出。每个useBlender应该对应一个popBlender。 |
+ | function popCamera() |
将渲染设备的_Camera栈的栈顶元素弹出,并将_RenderDevice属性camera赋为该弹出的元素值。 |
+ | function popClip() |
清空当前的clip。每个useClip都要对应一个popClip。
|
+ | function popClipper() |
渲染设备的_Clipper栈的栈顶元素弹出。每个useClipper应该对应一个popClipper。 |
+ | function popFog() |
渲染设备的_Fog栈的栈顶元素弹出。每个useFog应该对应一个popFog。 |
+ | function popLight() |
渲染设备的光栈的栈顶元素弹出。每个useLight应该对应一个popLight。 |
+ | function popMask() |
停止使用_Mask。 |
+ | function popMaterial() |
渲染设备的_Material栈的栈顶元素弹出。每个useMaterial应该对应一个popMaterial。 |
将3D的点(x, y, z)投影到屏幕上。 |
+ | function push2DMatrix(mat : _Matrix2D) |
将mat压入渲染设备的_Matrix2D栈。渲染设备会使用_Matrix2D栈顶的元素来渲染。每个应该对应一个pop2DMatrix。 |
+ | function push3DMatrix(mat : _Matrix3D) |
将mat压入渲染设备的_Matrix3D栈。渲染设备会使用_Matrix3D栈顶的元素来渲染。每个应该对应一个pop3DMatrix。 |
+ | function pushCamera() |
将_RenderDevice属性camera压入渲染设备的_Camera栈。 |
+ | function pushMul2DMatrixLeft(mat : _Matrix2D) |
将mat左乘当前Matrix2D栈的栈顶值,并将结果压栈。渲染设备会使用Matrix2D栈顶的元素来渲染。每个应该对应一个 pop2DMatrix。 |
+ | function pushMul2DMatrixRight(mat : _Matrix2D) |
将mat右乘当前_Matrix2D栈的栈顶值,并将结果压栈。渲染设备会使用_Matrix2D栈顶的元素来渲染。每个应该对应一个 pop2DMatrix。 |
+ | function pushMulMatrix3DLeft(mat : _Matrix3D) |
将mat左乘当前_Matrix3D栈的栈顶值,并将结果压栈。渲染设备会使用_Matrix3D栈顶的元素来渲染。每个应该对应一个 pop3DMatrix。 |
+ | function pushMulMatrix3DRight(mat : _Matrix3D) |
将mat右乘当前_Matrix3D栈的栈顶值,并将结果压栈。渲染设备会使用_Matrix3D栈顶的元素来渲染。每个应该对应一个 pop3DMatrix。 |
+ | function resetDrawBoard() |
停止使用_DrawBoard。 |
+ | function resetPickBoard() |
停止使用pickBoard。 |
+ | function setMissingImage(img : _Image) |
将加载图片失败时的默认图片改为img(默认为红白格),如果img为空,则改回红白格。 |
+ | function setResolution3D(x : int, y : int) |
降低3D分辨率,参数有效范围0~1
|
+ | function useBlender(blender : _Blender) |
将blender压入渲染设备的_Blender栈。渲染设备会使用_Blender栈中的所有元素来渲染。每个useBlender应该对应一个popBlender。 |
+ | function useClip(x1 : int, y1 : int, x2 : int, y2 : int, clip3d : bool) |
使用clip。
|
+ | function useClipper(clip : _Clipper) |
将clip压入渲染设备的_Clipper栈。渲染设备会使用_Clipper栈中的栈顶对象来渲染。每个useClipper应该对应一个popClipper。 |
+ | function useDrawBoard(drawBoard : _DrawBoard[, color : uint ]) |
开始使用_DrawBoard。之后的渲染都会渲染到drawBoard上。
|
+ | function useFog(fog : _Fog) |
将fog压入渲染设备的_Fog栈。渲染设备会使用_Fog栈中的栈顶对象来渲染。每个useFog应该对应一个popFog。 |
+ |
function useLight(light : _AmbientLight) function useLight(light : _SkyLight) function useLight(light : _PointLight) |
将light压入渲染设备的光栈。渲染设备会使用光栈中的所有元素来渲染。每个useLight应该对应一个popLight。 |
+ | function useMask(mask : _Mask) |
|
+ | function useMaterial(mtl : _Material) |
将材质压入渲染设备的_Material栈。渲染设备会使用_Material栈中的栈顶对象来渲染。每个useMaterial应该对应一个popMaterial。
|
+ | function usePickBoard(x1 : int, y1 : int, x2 : int, y2 : int) |
实现在drawBoard渲染的场景中拾取模型节点。点(x1, y1)和(x2, y2)定义的矩形应和drawBoard匹配。每个usePickBoard应该对应一个resetPickBoard。
|
_dofile('cameracontrol.lua')draws = {}draws.Axis = function() _rd:drawAxis(50) enddraws.Point =function() _rd:drawPoint(600, 300, _Color.Yellow) enddraws.Line = function() _rd:drawLine(500, 200, 600, 400, _Color.Red) enddraws.Triangle = function() _rd:drawTriangle(500, 200, 600, 400, 500, 300, _Color.Yellow) enddraws.Rect = function() _rd:drawRect(500, 200, 600, 400, _Color.Blue) enddraws['3DPoint'] = function() _rd:draw3DPoint(50, 50, 50, _Color.Yellow) enddraws['3DLine'] = function() _rd:draw3DLine(50, 50, 50, 200, 200, 350, _Color.Purple) enddraws['3DTriangle'] = function() _rd:draw3DTriangle(50, 50, 50, 25, 25, 50, 75, 25, 50, _Color.Blue) enddraws['3DCircle'] = function() _rd:draw3DCircle(50, 50, 50, 25, 25, 50, 30, 100, _Color.Yellow) enddraws['3DRect'] = function() _rd:draw3DRect(50, 50, 50, 10, 10, 5, 20, 15, 10, _Color.Red) endcurDraw = draws.Axis_app:onKeyDown(function(key) if key == _System.Key1 then curDraw = draws.Axis elseif key == _System.Key2 then curDraw = draws.Point elseif key == _System.Key3 then curDraw = draws.Line elseif key == _System.Key4 then curDraw = draws.Triangle elseif key == _System.Key5 then curDraw = draws.Rect elseif key == _System.Key6 then curDraw = draws['3DPoint'] elseif key == _System.Key7 then curDraw = draws['3DLine'] elseif key == _System.Key8 then curDraw = draws['3DTriangle'] elseif key == _System.Key9 then curDraw = draws['3DCircle'] elseif key == _System.Key0 then curDraw = draws['3DRect'] endend)noticefont = _Font.new('Arial', 10)noticefont.textColor = _Color.Yellow_app:onIdle(function(e) noticefont:drawText(0, 0, 'Press 1 to draw a Axis') noticefont:drawText(0, 14, 'Press 2 to draw a Point') noticefont:drawText(0, 28, 'Press 3 to draw a Line') noticefont:drawText(0, 42, 'Press 4 to draw a Triangle') noticefont:drawText(0, 56, 'Press 5 to draw a Rect') noticefont:drawText(0, 70, 'Press 6 to draw a 3DPoint') noticefont:drawText(0, 84, 'Press 7 to draw a 3DLine') noticefont:drawText(0, 98, 'Press 8 to draw a 3DTriangle') noticefont:drawText(0, 112, 'Press 9 to draw a 3DCircle') noticefont:drawText(0, 126, 'Press 0 to draw a 3DRect') curDraw()end)