public static void DrawSphere(Matrix World, Camera3D camera, Vector4 Color) { ColorEffectHolder.SetFromCamera(camera); ColorEffectHolder.SetWorld(World); ColorEffectHolder.MyEffect.Parameters["ObjectColor"].SetValue(Color); ColorEffectHolder.Apply(); Game1.graphics.GraphicsDevice.DrawUserIndexedPrimitives <VertexPositionColor>( PrimitiveType.LineList, SphereVerteces, 0, sphereLineCount * 2, SphereIndicies, 0, sphereLineCount); }
public static void DrawSphere(Matrix World, Camera3D camera, RenderTargetCube Cube) { CubeEffectHolder.SetFromCamera(camera); CubeEffectHolder.SetWorld(World); CubeEffectHolder.MyEffect.Parameters["ShadowReference"].SetValue(Cube); Render.DrawModel(CubeModel, CubeEffectHolder.MyEffect); }
public override void Draw3D(Camera3D camera, GameObjectTag DrawTag) { PointEffect.SetFromCamera(camera); PointEffect.SetFromObject(this); Render.DrawModel(PointModel, PointEffect.MyEffect); base.Draw3D(camera, DrawTag); }
public override void Draw3D(Camera3D camera, GameObjectTag DrawTag) { if (EditorSelected) { RingEffect.SetFromCamera(camera); RingEffect.SetFromObject(this);; Render.DrawModel(RingModel, RingEffect.MyEffect); base.Draw3D(camera, DrawTag); } }
public static void DrawModel(Model model, EffectValue effect, Camera3D camera, Basic3DObject obj) { if (model != null && effect.get() != null) { _3DEffect effect3D = (_3DEffect)effect.Holder; effect3D.SetFromObject(obj); effect3D.SetFromCamera(camera); DrawModel(model, effect3D.MyEffect); } }
public void Draw3D(Camera3D camera) { Camera3DObject c = (Camera3DObject)ParentScene.MyCamera.get(); if (c != null) { Vector3 Result = Vector3.Zero; bool Success = false; Basic3DObject.GetAveragePosition(ParentScene.SelectedGameObjects, ref Result, ref Success); WorldMatrix = c.ScaleMatrix * Matrix.CreateTranslation(Result); ColorEffectHolder.SetWorld(WorldMatrix); ColorEffectHolder.SetFromCamera(camera); foreach (EffectPass pass in ColorEffectHolder.MyEffect.CurrentTechnique.Passes) { pass.Apply(); Game1.graphics.GraphicsDevice.DrawUserIndexedPrimitives <VertexPositionColor>( PrimitiveType.LineList, PointList, 0, // vertex buffer offset to add to each element of the index buffer PointCount, // number of vertices in pointList Indicies, // the index buffer 0, // first index element to read PointCount / 2 // number of primitives to draw ); } ColorSetEffectHolder.Collection["Color"].SetValue(Color.LightGray.ToVector4()); ColorSetEffectHolder.SetFromCamera(camera); ColorSetEffectHolder.SetWorld(WorldMatrix); Render.DrawModel(CubeModel, ColorSetEffectHolder.MyEffect); Vector3 ScreenPos = WorldViewer.self.MyViewport.Project(Vector3.Zero, camera.ProjectionMatrix, camera.ViewMatrix, WorldMatrix); ScreenPositions[3] = new Vector2(ScreenPos.X, ScreenPos.Y); Model EndModel = controlMode == ControlMode.Move ? ArrowModel : controlMode == ControlMode.Rotate ? BallModel : CubeModel; for (int i = 0; i < 3; i++) { ColorSetEffectHolder.Collection["Color"].SetValue(PointColors[i].ToVector4()); ColorSetEffectHolder.SetWorld(ModelMatricies[i] * WorldMatrix); Render.DrawModel(EndModel, ColorSetEffectHolder.MyEffect); ScreenPos = WorldViewer.self.MyViewport.Project(Vector3.Zero, camera.ProjectionMatrix, camera.ViewMatrix, ModelMatricies[i] * WorldMatrix); ScreenPositions[i] = new Vector2(ScreenPos.X, ScreenPos.Y); } } }
public override void Draw3D(Camera3D camera, GameObjectTag DrawTag) { if (MyModel.get() != null && MyEffect.get() != null) { Game1.graphicsDevice.BlendState = BlendState.AlphaBlend; _3DEffect effect3D = (_3DEffect)MyEffect.Holder; effect3D.SetFromObject(this); effect3D.SetFromCamera(camera); Render.DrawModel(MyModel.get(), MyEffect.get()); } base.Draw3D(camera, DrawTag); }
public override void Draw3D(Camera3D camera, GameObjectTag DrawTag) { ColorEffectHolder.SetFromObject(this); ColorEffectHolder.SetFromCamera(camera); foreach (EffectPass pass in ColorEffectHolder.MyEffect.CurrentTechnique.Passes) { pass.Apply(); Game1.graphics.GraphicsDevice.DrawUserIndexedPrimitives <VertexPositionColor>( PrimitiveType.LineList, PointList, 0, // vertex buffer offset to add to each element of the index buffer PointCount, // number of vertices in pointList Indicies, // the index buffer 0, // first index element to read PointCount / 2 // number of primitives to draw ); } }