public void PrepareForDraw(MyEffectDistantImpostors effect) { if (!ImpostorProperties.Enabled) { return; } if (ImpostorProperties.ImpostorType == MyImpostorType.Nebula) { Matrix mat = Matrix.CreateScale(ImpostorProperties.MinDistance) * Matrix.CreateTranslation(MyCamera.Position * 0.5f); Matrix projection = Matrix.CreatePerspectiveFieldOfView(MyCamera.Zoom.GetFOV(), MyCamera.ForwardAspectRatio, 1000, 10000000); effect.SetWorldMatrix(mat); effect.SetViewProjectionMatrix(MyCamera.ViewMatrix * projection); effect.SetScale(ImpostorProperties.Radius * 0.00018f); effect.SetColor(ImpostorProperties.Color); effect.SetContrastAndIntensity(new Vector2(ImpostorProperties.Contrast, ImpostorProperties.Intensity)); effect.SetAnimation(m_animationTime); effect.SetCameraPos(MyCamera.Position); effect.SetSunDirection(-MyGuiScreenGamePlay.Static.GetDirectionToSunNormalized()); effect.SetTechnique(MyEffectDistantImpostors.Technique.Textured3D); effect.Begin(); MySimpleObjectDraw.ModelSphere.Render(); effect.End(); } }
public void PrepareForDraw(MyEffectDistantImpostors effect) { if (!ImpostorProperties.Enabled) { return; } if (ImpostorProperties.ImpostorType == MyImpostorType.Nebula) { Matrix mat = Matrix.CreateScale(ImpostorProperties.MinDistance) * Matrix.CreateTranslation((Vector3)MyRenderCamera.Position * 0.5f); Matrix projection = Matrix.CreatePerspectiveFieldOfView(MyRenderCamera.FieldOfView, MyRenderCamera.AspectRatio, 1000, 10000000); effect.SetWorldMatrix(mat); effect.SetViewProjectionMatrix((Matrix)(MyRenderCamera.ViewMatrix * projection)); effect.SetScale(ImpostorProperties.MaxRadius * 0.00018f); effect.SetColor(ImpostorProperties.Color); effect.SetContrastAndIntensity(new Vector2(ImpostorProperties.Contrast, ImpostorProperties.Intensity)); effect.SetAnimation(m_animationTime); effect.SetCameraPos((Vector3)MyRenderCamera.Position); effect.SetSunDirection(MyRender.Sun.Direction); effect.SetTechnique(MyEffectDistantImpostors.Technique.Textured3D); /* //todo missing texcoord0 * effect.Begin(); * MySimpleObjectDraw.ModelSphere.Render(); * effect.End(); */ } }