public void Draw(CCamera cam, GameTime gameTime) { if (shouldDrawPos && cam.BoundingVolumeIsInView(posGizmo.BoundingSphere)) { posGizmo._modelScale = Vector3.Distance(cam._cameraPos, posGizmo._modelPosition) * gizmoSize; posGizmo.Draw(cam._view, cam._projection, cam._cameraPos); } else if (shouldDrawRot && cam.BoundingVolumeIsInView(rotGizmo.BoundingSphere)) { rotGizmo._modelScale = Vector3.Distance(cam._cameraPos, rotGizmo._modelPosition) * gizmoSize; rotGizmo.Draw(cam._view, cam._projection, cam._cameraPos); } else if (shouldDrawScale && cam.BoundingVolumeIsInView(scaleGizmo.BoundingSphere)) { scaleGizmo._modelScale = Vector3.Distance(cam._cameraPos, rotGizmo._modelPosition) * gizmoSize; scaleGizmo.Draw(cam._view, cam._projection, cam._cameraPos); } }
/// <summary> /// Pre-draw the water effect: gets the reflection image /// </summary> /// <param name="camera">The camera class</param> /// <param name="gameTime">GameTime snapshot</param> public void PreDraw(CCamera camera, GameTime gameTime) { isInView = camera.BoundingVolumeIsInView(RealBoundingBox); if (isInView) { renderReflection(camera, gameTime); waterEffect.Parameters["Time"].SetValue((float)gameTime.TotalGameTime.TotalSeconds); } }
public static void Draw(CCamera cam, GameTime gameTime) { //renderer.ShadowLightPosition = CLightsManager.lights[0].Position; //renderer.ShadowLightTarget = new Vector3(renderer.ShadowLightTarget.X, renderer.ShadowLightTarget.Y - 0.1f, renderer.ShadowLightTarget.Z); foreach (CModel model in modelsList) { if (cam.BoundingVolumeIsInView(model.BoundingSphere)) { model.Draw(cam._view, cam._projection, cam._cameraPos); if (selectModelId != -1 && modelsList[selectModelId] == model) { CSimpleShapes.AddBoundingBox(modelsList[selectModelId]._boundingBox, Color.Black); } if (DebugActivated) { Matrix worldMatrix = model.GetModelMatrix(); foreach (Triangle tri in model._trianglesPositions) { Triangle realTri = tri.NewByMatrix(worldMatrix); CSimpleShapes.AddTriangle(realTri.V0, realTri.V1, realTri.V2, Color.Black); } } } } /*for (int i = 0; i < cam._physicsMap._triangleList.Count; i++) // Debug triangles collision * CSimpleShapes.AddTriangle(cam._physicsMap._triangleList[i].V0, cam._physicsMap._triangleList[i].V1, cam._physicsMap._triangleList[i].V2, Color.Blue); * for (int i = 0; i < cam._physicsMap._triangleNormalsList.Count; i++) // Debug triangles collision * CSimpleShapes.AddLine(cam._physicsMap._triangleNormalsList[i], cam._physicsMap._triangleNormalsList[i] * 2, Color.Red);*/ /*Matrix modelMatrix = modelsList[0].GetModelMatrix(); * for (int i = 0; i < modelsList[0]._trianglesPositions.Count; i++) * CSimpleShapes.AddTriangle(Vector3.Transform(modelsList[0]._trianglesPositions[i].V0, modelMatrix), * Vector3.Transform(modelsList[0]._trianglesPositions[i].V1, modelMatrix), * Vector3.Transform(modelsList[0]._trianglesPositions[i].V2, modelMatrix), Color.Red);*/ }