public static extern IntPtr SceneManager_addCamera( vector3df position, vector3df lookat, vector3df up, float near, float far, float fov);
public vector3df GetAxisDir(E_AXIS axis) { vector3df v = new vector3df(); CoordSceneNode_getDir(pointer, axis, out v); return(v); }
public vector3df GetCenter() { vector3df v = new vector3df(); WDTSceneNode_getCenter(pointer, out v); return(v); }
vector3df getRotationRadians() { matrix4 mat = this; vector3df scale = getScale(); vector3df invScale = new vector3df(1.0f / scale.X, 1.0f / scale.Y, 1.0f / scale.Z); float Y = -NewMath.FASin(mat[2] * invScale.X); float C = NewMath.FCos(Y); float rotx, roty, X, Z; if (Math.Abs(C) > 0.0005f) { float invC = 1.0f / C; rotx = mat[10] * invC * invScale.Z; roty = mat[6] * invC * invScale.Y; X = NewMath.FATan2(roty, rotx); rotx = mat[0] * invC * invScale.X; roty = mat[1] * invC * invScale.X; Z = NewMath.FATan2(roty, rotx); } else { X = 0; rotx = mat[5] * invScale.Y; roty = -mat[4] * invScale.Y; Z = NewMath.FATan2(roty, rotx); } // fix values that get below zero // before it would set (!) values to 360 // that were above 360: if (X < 0.0) { X += 2 * NewMath.PI; } if (Y < 0.0) { Y += 2 * NewMath.PI; } if (Z < 0.0) { Z += 2 * NewMath.PI; } return(new vector3df(X, Y, Z)); }
void setScale(vector3df scale) { if (isIdentity()) { M[0] = scale.X; M[5] = scale.Y; M[10] = scale.Z; } matrix4 mat = new matrix4(true); mat[0] = scale.X; mat[5] = scale.Y; mat[10] = scale.Z; matrix4 self = this; setByProduct(ref self, ref mat); }
void setRotationRadians(vector3df rotation) { float cr = NewMath.FCos(rotation.X); float sr = NewMath.FSin(rotation.X); float cp = NewMath.FCos(rotation.Y); float sp = NewMath.FSin(rotation.Y); float cy = NewMath.FCos(rotation.Z); float sy = NewMath.FSin(rotation.Z); M[0] = (float)(cp * cy); M[1] = (float)(cp * sy); M[2] = (float)(-sp); double srsp = sr * sp; double crsp = cr * sp; M[4] = (float)(srsp * cy - cr * sy); M[5] = (float)(srsp * sy + cr * cy); M[6] = (float)(sr * cp); M[8] = (float)(crsp * cy + sr * sy); M[9] = (float)(crsp * sy - sr * cy); M[10] = (float)(cr * cp); }
public static extern void MapTileSceneNode_getCenter( IntPtr node, out vector3df pos);
public static extern void m2Move_setScale( IntPtr m2move, ref vector3df scale);
public static extern void m2Move_getScale( IntPtr m2move, out vector3df scale);
public static extern void m2Move_setPos( IntPtr m2move, ref vector3df pos);
public static extern void m2Move_getPos( IntPtr m2move, out vector3df pos);
public static extern void m2Move_setDir( IntPtr m2move, ref vector3df dir);
public static extern void m2Move_getDir( IntPtr m2move, out vector3df dir);
public static extern void Camera_getDir( IntPtr cam, out vector3df dir);
public static extern void Camera_getPosition( IntPtr cam, out vector3df pos);
public static extern void SceneEnvironment_setLightDir(vector3df dir);
public static extern void Camera_getLookat( IntPtr cam, out vector3df lookat);
void setTranslation(vector3df translation) { M[12] = translation.X; M[13] = translation.Y; M[14] = translation.Z; }
void setRotationDegrees(vector3df rotation) { setRotationRadians(rotation * NewMath.DEGTORAD); }
public static extern void Camera_getUp( IntPtr cam, out vector3df up);
public static extern void CoordSceneNode_getDir(IntPtr node, E_AXIS axis, out vector3df dir);
public Camera AddCamera(vector3df position, vector3df lookat, vector3df up, float near, float far, float fov) { IntPtr raw = SceneManager_addCamera(position, lookat, up, near, far, fov); return(new Camera(raw)); }
public void SetAxisDir(E_AXIS axis, vector3df dir) { CoordSceneNode_setDir(pointer, axis, dir); }
public static extern void SceneEnvrionment_getLightDir(out vector3df dir);
public static extern void Camera_setUp( IntPtr cam, vector3df up);