Overview:
+ added LINES draw mode
+ refined AnimatorCameraModelViewer
+ added mouse wheel handler
--- https://klstrigo.svn.sourceforge.net/svnroot/klstrigo/WebSites/K.L.'s Trigo/tags/copperlicht 1.3.3/copperlicht.js +++ https://klstrigo.svn.sourceforge.net/svnroot/klstrigo/WebSites/K.L.'s Trigo/trunk/Source/static/js/copperlicht.js @@ -2056,6 +2056,7 @@ this.Indices = new Array(); this.Vertices = new Array(); this.RendererNativeArray = null; + this.DrawMode = CL3D.Renderer.DrawModes.TRIANGLES; }; CL3D.MeshBuffer.prototype.Box = null; CL3D.MeshBuffer.prototype.Mat = null; @@ -2929,9 +2930,18 @@ this.Program2DDrawingColorOnly = null; this.Program2DDrawingTextureOnly = null; this.Program2DDrawingCanvasFontColor = null; - this.Material = null; + //this.Material = null; this.currentGLProgram = null; }; +CL3D.Renderer.DrawModes = { + POINTS: 0x0000, + LINES: 0x0001, + LINE_LOOP: 0x0002, + LINE_STRIP: 0x0003, + TRIANGLES: 0x0004, + TRIANGLE_STRIP: 0x0005, + TRIANGLE_FAN: 0x0006, +} CL3D.Renderer.prototype.Material = null; CL3D.Renderer.prototype.getWidth = function () { return this.width; @@ -3048,10 +3058,19 @@ } var m = a.Indices.length; var n = new WebGLUnsignedShortArray(m); - for (var d = 0; d < m; d += 3) { - n[d + 0] = a.Indices[d + 0]; - n[d + 1] = a.Indices[d + 2]; - n[d + 2] = a.Indices[d + 1]; + switch(a.DrawMode) + { + case CL3D.Renderer.DrawModes.TRIANGLES: + for (var d = 0; d < m; d += 3) { + n[d + 0] = a.Indices[d + 0]; + n[d + 1] = a.Indices[d + 2]; + n[d + 2] = a.Indices[d + 1]; + } + + break; + default: + for (var d = 0; d < m; ++d) + n[d] = a.Indices[d]; } f.positionBuffer = g.createBuffer(); g.bindBuffer(g.ARRAY_BUFFER, f.positionBuffer); @@ -3071,6 +3090,7 @@ g.bufferData(g.ELEMENT_ARRAY_BUFFER, n, g.STATIC_DRAW); f.indexCount = m; g.bindBuffer(g.ELEMENT_ARRAY_BUFFER, null); + f.drawMode = a.DrawMode; a.RendererNativeArray = f; } this.drawWebGlStaticGeometry(a.RendererNativeArray); @@ -3111,7 +3131,7 @@ f = f.multiply(this.World); g.uniformMatrix4fv(c.locModelViewMatrix, false, this.getMatrixAsWebGLFloatArray(f)); } - g.drawElements(g.TRIANGLES, a.indexCount, g.UNSIGNED_SHORT, 0); + g.drawElements(a.drawMode, a.indexCount, g.UNSIGNED_SHORT, 0); }; CL3D.Renderer.prototype.draw3DLine = function (b, a) {}; CL3D.Renderer.prototype.draw2DRectangle = function (k, h, a, p, b, e) { @@ -5127,7 +5147,7 @@ }; CL3D.AnimatorCameraFPS.prototype. = function (a) { CL3D.Animator.prototype..call(this, a); - this.targetZoomValue += a.delta * zoomSpeed; + this.targetZoomValue += a.delta * this.zoomSpeed; if (this.targetZoomValue < this.minZoom) { this.targetZoomValue = this.minZoom; } @@ -5187,7 +5207,7 @@ }; CL3D.AnimatorCameraModelViewer = function (b, a) { this.Type = -1; - this.RotateSpeed = 0.06; + this.RotateSpeed = 16; this.Radius = 100; this.NoVerticalMovement = false; this.lastAnimTime = CL3D.CLTimer.getTime(); @@ -5224,13 +5244,13 @@ l.Y = 0; l.normalize(); if (!CL3D.iszero(f)) { - l.multiplyThisWithScal(a * f); + l.multiplyThisWithScal(a * f * this.Radius); o.addToThis(l); } if (!this.NoVerticalMovement && !CL3D.iszero(d)) { var h = this.Camera.UpVector.clone(); h.normalize(); - var k = o.add(h.multiplyWithScal(a * d)); + var k = o.add(h.multiplyWithScal(a * d * this.Radius)); var g = k.clone(); g.Y = j.Y; var p = this.Radius / 10; @@ -7306,6 +7326,18 @@ b.(a); } }; +CL3D.CopperLicht.prototype.handleMouseWheel = function (a) { + if (this.MouseIsInside) { + var c = this.getScene(); + if (c == null) { + return; + } + var b = c.getActiveCamera(); + if (b != null) { + b.(a); + } + } +}; CL3D.CopperLicht.prototype.OnAnimate = null; CL3D.CopperLicht.prototype.OnAfterDrawAll = null;
|