How To Move Camera in Tao Opengl Framework in C# (WFA)? -
i'm trying make class control camera in opengl in c# using tao framework class including
- -moving camera , down , right , left
- -rotate camera
- -apply of transformation main camera
every thing work when apply transformation main camera nothing work
this class
using system; using system.collections.generic; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using tao.opengl; using tao.sdl; using visualization; using mathnet.numerics.linearalgebra; using mathnet.numerics.linearalgebra.double; using mathnet.spatial.euclidean; namespace visualiation_assignment_2 { class cameracontroller { public vector3d cameraposition; public vector3d cameraup; public vector3d cameraright; public vector3d cameradirection; public vector3d camerlook; public double prespectivangle; public double znear, zfar; public double aspectratio; public cameracontroller() { gl.glenable(gl.gl_depth_test); gl.gldepthfunc(gl.gl_less); } public void movefront(double distance) { cameraposition -= distance * cameradirection; } public void moveright(double distance) { cameraposition += distance * cameraright; } public void moveup(double distance) { cameraposition += distance * cameraup; } public void yaw(double angledegree) { mathnet.spatial.units.angle theangel = new mathnet.spatial.units.angle(angledegree, mathnet.spatial.units.angleunit.degrees); cameradirection = cameradirection.rotate(cameraup, theangel); cameraright = cameraright.rotate(cameraup, theangel); } public void pitch(double angledegree) { mathnet.spatial.units.angle theangel = new mathnet.spatial.units.angle(angledegree, mathnet.spatial.units.angleunit.degrees); cameraup = cameraup.rotate(cameraright, theangel); cameradirection = cameradirection.rotate(cameraright , theangel); } public void roll(double angledegree) { mathnet.spatial.units.angle theangel = new mathnet.spatial.units.angle(angledegree, mathnet.spatial.units.angleunit.degrees); cameraright = cameraright.rotate(cameradirection, theangel); cameraup = cameraup.rotate(cameraposition, theangel); } public void updateview() { gl.glpushmatrix(); gl.glmatrixmode(gl.gl_projection); gl.glloadidentity(); glu.gluperspective(prespectivangle , aspectratio , znear , zfar); gl.glmatrixmode(gl.gl_modelview); gl.glloadidentity(); glu.glulookat(cameraposition.x , cameraposition.y , cameraposition.z , camerlook.x , camerlook.y , camerlook.z , cameraup.x , cameraup.y , cameraup.z); } }
}
any ?? in advance
Comments
Post a Comment