GDS2WebGL icon indicating copy to clipboard operation
GDS2WebGL copied to clipboard

disabling perspective distortion

Open nmz787 opened this issue 4 years ago • 1 comments

I'm concerned that if I use this, veteran designers will be confused and assume there are problems with the design if the perspective distortion is present. Can you link to a section (or multiple if present) of the code where this is performed, such that I could work on hooking up a UI toggle for enabling/disabling the feature?

nmz787 avatar Oct 08 '21 20:10 nmz787

Some progress with help from a chatroom! This works in the sense of zooming and no perspective distortion, but panning is backwards/opposite, and the layers auto-hiding with zoom is probably undesirable if you're comparing exact edge-placement/alignment between layers at high-zoom (but I'm not sure what an easy UI change would be, it seems like the sort of thing for a layer list panel with display toggles).

Changing this line: https://github.com/s-holst/GDS2WebGL/blob/master/app.js#L372

from: glMatrix.mat4.perspective(projectionMatrix, fovy * Math.PI / 180, gl.canvas.width / gl.canvas.height, zNear-0.01, zFar+0.001);

to: glMatrix.mat4.ortho(projectionMatrix,, 1.0*z_position*(gl.canvas.width/gl.canvas.height), -1.0*z_position*(gl.canvas.width/gl.canvas.height), 1.0*z_position, -1.0*z_position, zNear-0.01, zFar+0.001);

Actually, i changed it in the spm.html so I didn't have to install anything to get to playing around, so the swap there is: from: Xe.mat4.perspective($e,15*Math.PI/180,t.canvas.width/t.canvas.height,.1-.01,8.001),

to: Xe.mat4.ortho($e, 1.0*hr*(t.canvas.width/t.canvas.height), -1.0*hr*(t.canvas.width/t.canvas.height), 1.0*hr, -1.0*hr, .1-.01,8.001),

nmz787 avatar Aug 12 '22 09:08 nmz787