public override void Draw3D(Camera3D camera, GameObjectTag DrawTag) { PointEffect.SetFromCamera(camera); PointEffect.SetFromObject(this); Render.DrawModel(PointModel, PointEffect.MyEffect); base.Draw3D(camera, DrawTag); }
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) { if (EditorSelected) { RingEffect.SetFromCamera(camera); RingEffect.SetFromObject(this);; Render.DrawModel(RingModel, RingEffect.MyEffect); base.Draw3D(camera, DrawTag); } }
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 DrawSingle(Vector3 Position, float Size, Vector4 Color, Camera3D DrawCamera) { WorldParam.SetValue(ModelTransformMatrix * Matrix.CreateScale(Size) * Matrix.CreateTranslation(Position)); ViewParam.SetValue(DrawCamera.ViewMatrix); ProjectionParam.SetValue(DrawCamera.ProjectionMatrix); ViewPosParam.SetValue(DrawCamera.Position); ColorParameter.SetValue(Color); ShipEffect.CurrentTechnique = ForwardTechnique; Render.DrawModel(ShipModel, ShipEffect); ColorParameter.SetValue(DrawColor * ColorMult); WorldParam.SetValue(ModelTransformMatrix); }
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) { if (lightState == BasicLight.LightState.Dead) { base.Draw3D(camera, DrawTag); return; } if (DrawTag == GameObjectTag._3DPreDraw) { if (RealtimeShadows.get()) { DrawShadows(); } } else { #if EDITOR && WINDOWS if (DrawTag == GameObjectTag._3DForward) { if (EditorSelected) { Vector4 Col = Vector4.One; ShapeRenderer.DrawSphere(WorldMatrix, camera, Col); } if (ShadowCube != null) { ShapeRenderer.DrawSphere(WorldMatrix, camera, ShadowCube.Value); } } else #endif if (MyEffect.Holder != null) { Game1.graphicsDevice.RasterizerState = RasterizerState.CullClockwise; DeferredLightEffect effect3D = (DeferredLightEffect)MyEffect.Holder; effect3D.SetTextureSize(ParentScene.WindowSize); effect3D.SetUV(camera); effect3D.SetInverseCamera(camera); effect3D.SetLight(Position.get(), Scale.get() / 2); effect3D.SetFromObject(this); effect3D.SetFromCamera(camera); effect3D.MyEffect.CurrentTechnique.Passes[0].Apply(); Render.DrawModel(SphereModel, MyEffect.get()); } } base.Draw3D(camera, DrawTag); }
public override void Draw3D(Camera3D camera, GameObjectTag DrawTag) { Lit3DEffect effect3D = (Lit3DEffect)effect.Holder; if (effect3D != null) { effect3D.SetForwardTechnique(); effect3D.SetAmbientLight(AmbientLightColor.get()); effect3D.SetLightOne(LightOneColor.get(), Vector3.Normalize(LightOneDirection.get())); effect3D.SetLightTwo(LightTwoColor.get(), Vector3.Normalize(LightTwoDirection.get())); Render.DrawModel(model, effect, camera, this); } base.Draw3D(camera, DrawTag); }
public override void Draw3D(Camera3D camera, GameObjectTag DrawTag) { if (MyModel.get() != null && MyEffect.get() != null) { Deferred3DEffect effect3D = (Deferred3DEffect)MyEffect.Holder; switch (DrawTag) { case GameObjectTag._3DDeferredGBuffer: { effect3D.SetWorldViewIT(camera, this); effect3D.SetFromObject(this); effect3D.SetFromCamera(camera); effect3D.SetDeferredTechnique(); break; } case GameObjectTag._3DShadow: { effect3D.SetFromObject(this); effect3D.SetFromCamera(camera); effect3D.SetShadowTechnique(); effect3D.SetLight(Transfer.LightPosition, Transfer.LightDistance); break; } default: { effect3D.SetFromCamera(camera); effect3D.SetUV(camera); if (!UseDeferred.get()) { effect3D.SetFromObject(this); } effect3D.SetForwardTechnique(); break; } } Render.DrawModel(MyModel.get(), MyEffect.get()); } base.Draw3D(camera, DrawTag); }
public override void Draw3D(Camera3D camera, GameObjectTag DrawTag) { Render.DrawModel(SkyboxModel, MyEffect, camera, this); base.Draw3D(camera, DrawTag); }