public void project(warp_Matrix vertexProjection, warp_Matrix normalProjection, warp_Camera camera) // Projects this vertex into camera space { pos2 = pos.transform(vertexProjection); n2 = n.transform(normalProjection); float fact; if (camera.isOrthographic) { x = (int)(pos2.x * (camera.screenscale / camera.orthoViewWidth) + (camera.screenwidth >> 1)); y = (int)(-pos2.y * (camera.screenscale / camera.orthoViewHeight) + (camera.screenheight >> 1)); } else { fact = camera.screenscale / camera.fovfact / ((pos2.z > 0.1) ? pos2.z : 0.1f); x = (int)(pos2.x * fact + (camera.screenwidth >> 1)); y = (int)(-pos2.y * fact + (camera.screenheight >> 1)); } z = (int)(65536f * pos2.z); sw = -(pos2.z); nx = (int)(n2.x * 127 + 127); ny = (int)(n2.y * 127 + 127); if (parent.material == null) { return; } if (parent.material.texture == null) { return; } tx = (int)((float)parent.material.texture.width * u); ty = (int)((float)parent.material.texture.height * v); }
public void shift(float dx, float dy, float dz) { pos = pos.transform(warp_Matrix.shiftMatrix(dx, dy, dz)); lookat = lookat.transform(warp_Matrix.shiftMatrix(dx, dy, dz)); needsRebuild = true; }