Exemplo n.º 1
0
        public void UpdateLight()
        {
            UpdateSpotParams();

            if (m_propertiesDirty || m_positionDirty)
            {
                ProfilerShort.Begin("UpdateRenderLight");

                m_propertiesDirty = m_positionDirty = false;

                MyLightLayout pointLight = new MyLightLayout()
                {
                    Range = Range,
                    Color = Color,
                    Falloff = Falloff,
                    GlossFactor = GlossFactor,
                    DiffuseFactor = DiffuseFactor,
                };
                
                MySpotLightLayout spotLight = new MySpotLightLayout()
                {
                    Light = new MyLightLayout()
                    {
                        Range = ReflectorRange,
                        Color = ReflectorColor,
                        Falloff = ReflectorFalloff,
                        GlossFactor = ReflectorGlossFactor,
                        DiffuseFactor = ReflectorDiffuseFactor,
                    },
                    Up = ReflectorUp,
                    Direction = ReflectorDirection,
                };

                MyFlareDesc glare = new MyFlareDesc()
                {
                    Enabled = GlareOn,
                    Direction = ReflectorDirection,
                    Range = Range,
                    Color = Color,
                    Type = GlareType,
                    Size = GlareSize,
                    QuerySize = GlareQuerySize,
                    Intensity = GlareIntensity,
                    Material = MyStringId.GetOrCompute(GlareMaterial),
                    MaxDistance = GlareMaxDistance,
                };

                UpdateRenderLightData renderLightData = new UpdateRenderLightData()
                {
                    ID = RenderObjectID,
                    Position = Position,
                    Type = (VRageRender.LightTypeEnum)(int)LightType,
                    ParentID = ParentID,
                    PointPositionOffset = PointLightOffset,
                    SpecularColor = SpecularColor,
                    UseInForwardRender = UseInForwardRender,
                    ReflectorConeMaxAngleCos = ReflectorConeMaxAngleCos,
                    ShadowDistance = ShadowDistance,
                    CastShadows = CastShadows,
                    PointLightOn = LightOn,
                    PointLightIntensity = Intensity,
                    PointLight = pointLight,
                    SpotLightOn = ReflectorOn,
                    SpotLightIntensity = ReflectorIntensity,
                    SpotLight = spotLight,
                    ReflectorTexture = ReflectorTexture,
                    Glare = glare,
                };

                MyRenderProxy.UpdateRenderLight(ref renderLightData);

                ProfilerShort.End();
            }
        }
Exemplo n.º 2
0
 public static void UpdateRenderLight(ref UpdateRenderLightData data)
 {
     var message = MessagePool.Get<MyRenderMessageUpdateRenderLight>(MyRenderMessageEnum.UpdateRenderLight);
     message.Data = data;
     EnqueueMessage(message);
 }