Ejemplo n.º 1
0
 private void DrawReflectorCone()
 {
     if (!((MySession.Static.CameraController is MyCockpit) ? ((MyCockpit)MySession.Static.CameraController).IsInFirstPersonView : false) && !string.IsNullOrEmpty(this.m_reflectorLight.ReflectorConeMaterial))
     {
         Matrix  matrix;
         MatrixD worldMatrix = this.m_reflectorLight.WorldMatrix;
         float   num2        = MathHelper.Saturate((float)(1f - ((float)Math.Pow((double)Math.Abs(Vector3.Dot(Vector3.Normalize(MySector.MainCamera.Position - worldMatrix.Translation), (Vector3)worldMatrix.Forward)), 30.0))));
         this.m_reflectorLight.GetLocalMatrix(out matrix);
         uint     renderObjectID = this.m_reflectorLight.CubeGrid.Render.GetRenderObjectID();
         Vector3D translation    = matrix.Translation;
         Vector3D forward        = matrix.Forward;
         float    length         = Math.Max((float)15f, (float)(this.m_reflectorLight.ReflectorRadius * 0.25f));
         if (!this.m_reflectorLight.IsLargeLight)
         {
             length *= 0.5f;
         }
         Color color = this.m_reflectorLight.Color;
         float n     = (this.m_reflectorLight.CurrentLightPower * this.m_reflectorLight.Intensity) * 0.8f;
         translation += (forward * this.m_reflectorLight.CubeGrid.GridSize) * 0.5;
         MyTransparentGeometry.AddLocalLineBillboard(MyStringId.GetOrCompute(this.m_reflectorLight.ReflectorConeMaterial), (color.ToVector4() * num2) * MathHelper.Saturate(n), translation, renderObjectID, (Vector3)forward, length, this.m_reflectorLight.IsLargeLight ? 11f : 2.5f, MyBillboard.BlendTypeEnum.AdditiveBottom, -1, 1f, null);
     }
 }