public void Draw(MyEffectDistantImpostors effect, MyImpostorType impostorType) { if (!ImpostorProperties.Enabled) { return; } if (impostorType != ImpostorProperties.ImpostorType) { return; } if (ImpostorProperties.ImpostorType == MyImpostorType.Billboards) { if (m_trianglesCount <= 0) { return; } m_animationTime += ImpostorProperties.AnimationSpeed; Device device = MyMinerGame.Static.GraphicsDevice; if (MyRenderConstants.RenderQualityProfile.ForwardRender) { DepthStencilState.DepthRead.Apply(); } Matrix worldMatrix = Matrix.Identity; if (ImpostorProperties.AnimationSpeed.X > 0) { worldMatrix *= Matrix.CreateRotationX(m_animationTime.X); } if (ImpostorProperties.AnimationSpeed.Y > 0) { worldMatrix *= Matrix.CreateRotationX(m_animationTime.Y); } if (ImpostorProperties.AnimationSpeed.Z > 0) { worldMatrix *= Matrix.CreateRotationX(m_animationTime.Z); } worldMatrix.Translation = MyCamera.Position * 0.5f; effect.SetWorldMatrix(worldMatrix); MyTexture2D texture = null; if (ImpostorProperties.Material.HasValue) { texture = MyTransparentGeometry.GetTexture(ImpostorProperties.Material.Value); } effect.SetImpostorTexture(texture); device.SetStreamSource(0, m_vertexBuffer, 0, MyVertexFormatPositionTextureColor.Stride); device.VertexDeclaration = MyVertexFormatPositionTextureColor.VertexDeclaration; effect.SetTechnique(MyEffectDistantImpostors.Technique.ColoredLit); effect.Begin(); device.DrawPrimitives(PrimitiveType.TriangleList, 0, m_trianglesCount); effect.End(); MyPerformanceCounter.PerCameraDraw.TotalDrawCalls++; } else if (ImpostorProperties.ImpostorType == MyImpostorType.Nebula && !MyRenderConstants.RenderQualityProfile.ForwardRender) { m_animationTime += ImpostorProperties.AnimationSpeed * (MyFpsManager.FrameTime / 100.0f); BlendState.NonPremultiplied.Apply(); RasterizerState.CullCounterClockwise.Apply(); DepthStencilState.None.Apply(); MyRender.Blit(MyRender.GetRenderTarget(MyRenderTargets.AuxiliaryHalf0), true); } }