Example #1
0
        public void Start(LightTypeEnum lightType, float falloff)
        {
            Start();
            LightType = lightType;

            if ((lightType & MyLight.LightTypeEnum.PointLight) != 0)
            {
                Falloff = falloff;
                PointOn = true;
            }

            if ((lightType & MyLight.LightTypeEnum.Hemisphere) != 0)
            {
                Falloff = falloff;
                PointOn = true;
            }

            if ((lightType & MyLight.LightTypeEnum.Spotlight) != 0)
            {
                ReflectorFalloff = falloff;
                ReflectorOn      = true;
            }

            LightOwner = LightOwnerEnum.None;
        }
Example #2
0
        public void Start(LightTypeEnum lightType, Vector4 color, float falloff, float range)
        {
            Start(lightType, falloff);

            Color = color;
            Range = range;
        }
Example #3
0
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.Index           = binaryReader.ReadInt32();
     this.LightType       = ((LightTypeEnum)(binaryReader.ReadInt16()));
     this.AttachmentIndex = binaryReader.ReadByte();
     this.ObjectType      = binaryReader.ReadByte();
     pointerQueue         = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(pointerQueue.Concat(this.Visibility.ReadFields(binaryReader)));
     return(pointerQueue);
 }
Example #4
0
 //  IMPORTANT: This class isn't realy inicialized by constructor, but by Start()
 public void Start(LightTypeEnum lightType, Vector3 position, Vector4 color, float falloff, float range)
 {
     Start(lightType, color, falloff, range);
     SetPosition(position);
 }
Example #5
0
 public void Start(LightTypeEnum lightType, Vector4 color, float falloff, float range)
 {
     Start(lightType, falloff);
     Color = color;
     Range = range;
 }
Example #6
0
        public void Start(LightTypeEnum lightType, float falloff)
        {
            Start();
            LightType = lightType;

            if ((lightType & MyLight.LightTypeEnum.PointLight) != 0)
            {
                Falloff = falloff;
                PointOn = true;
            }

            if ((lightType & MyLight.LightTypeEnum.Hemisphere) != 0)
            {
                Falloff = falloff;
                PointOn = true;
            }

            if ((lightType & MyLight.LightTypeEnum.Spotlight) != 0)
            {
                ReflectorFalloff = falloff;
                ReflectorOn = true;
            }

            LightOwner = LightOwnerEnum.None;
        }
Example #7
0
 public void Start(LightTypeEnum lightType, Vector3 position, Vector4 color, float falloff, float range)
 {
     Start(lightType, color, falloff, range);
     Position = position;
 }
        public static void UpdateRenderLight(
          uint id,
          LightTypeEnum type,
          Vector3D position,
          int renderObjectID,
          float offset,
          Color color,
          Color specularColor,
          float falloff,
          float range,
          float intensity,
          bool lightOn,
          bool useInForwardRender,
          float reflectorIntensity,
          bool reflectorOn,
          Vector3 reflectorDirection,
          Vector3 reflectorUp,
          float reflectorConeMaxAngleCos,
          Color reflectorColor,
          float reflectorRange,
          float reflectorFalloff,
          string reflectorTexture,
          float shadowDistance,
          bool castShadows,
          bool glareOn,
          MyGlareTypeEnum glareType,
          float glareSize,
          float glareQuerySize,
          float glareIntensity,
          string glareMaterial,
          float glareMaxDistance
          )
        {
            var message = MessagePool.Get<MyRenderMessageUpdateRenderLight>(MyRenderMessageEnum.UpdateRenderLight);

            message.ID = id;
            message.Type = type;
            message.Position = position;
            message.ParentID = renderObjectID;
            message.Offset = offset;
            message.Color = color;
            message.SpecularColor = specularColor;
            message.Falloff = falloff;
            message.Range = range;
            message.Intensity = intensity;
            message.LightOn = lightOn;
            message.UseInForwardRender = useInForwardRender;
            message.ReflectorIntensity = reflectorIntensity;
            message.ReflectorOn = reflectorOn;
            message.ReflectorDirection = reflectorDirection;
            message.ReflectorUp = reflectorUp;
            message.ReflectorConeMaxAngleCos = reflectorConeMaxAngleCos;
            message.ReflectorColor = reflectorColor;
            message.ReflectorRange = reflectorRange;
            message.ReflectorFalloff = reflectorFalloff;
            message.ReflectorTexture = reflectorTexture;
            message.ShadowDistance = shadowDistance;
            message.CastShadows = castShadows;
            message.GlareOn = glareOn;
            message.GlareType = glareType;
            message.GlareSize = glareSize;
            message.GlareQuerySize = glareQuerySize;
            message.GlareIntensity = glareIntensity;
            message.GlareMaterial = glareMaterial;
            message.GlareMaxDistance = glareMaxDistance;

            EnqueueMessage(message);
        }
        public static uint CreateRenderLight(
            LightTypeEnum type,
            Vector3D position,
            int renderObjectID,
            float offset,
            Color color,
            Color specularColor,
            float falloff,
            float range,
            float intensity,
            bool lightOn,
            bool useInForwardRender,
            float reflectorIntensity,
            bool reflectorOn,
            Vector3 reflectorDirection,
            Vector3 reflectorUp,
            float reflectorConeMaxAngleCos,
            Color reflectorColor,
            float reflectorRange,
            float reflectorFalloff,
            string reflectorTexture,
            float shadowDistance,
            bool castShadows,
            bool glareOn,
            MyGlareTypeEnum glareType,
            float glareSize,
            float glareQuerySize,
            float glareIntensity,
            string glareMaterial,
            float glareMaxDistance
            )
        {
            var message = MessagePool.Get<MyRenderMessageCreateRenderLight>(MyRenderMessageEnum.CreateRenderLight);

            uint id = GetMessageId();
            message.ID = id;

            EnqueueMessage(message);

            UpdateRenderLight(
                id,
                type,
                position,
                renderObjectID,
                offset,
                color,
                specularColor,
                falloff,
                range,
                intensity,
                lightOn,
                useInForwardRender,
                reflectorIntensity,
                reflectorOn,
                reflectorDirection,
                reflectorUp,
                reflectorConeMaxAngleCos,
                reflectorColor,
                reflectorRange,
                reflectorFalloff,
                reflectorTexture,
                shadowDistance,
                castShadows,
                glareOn,
                glareType,
                glareSize,
                glareQuerySize,
                glareIntensity,
                glareMaterial,
                glareMaxDistance
                );

            return id;
        }
        public void UpdateParameters(
            LightTypeEnum type,
            Vector3D position,
            int parentID,
            float offset,
            Color color,
            Color specularColor,
            float falloff,
            float range,
            float intensity,
            bool lightOn, 
            bool useInForwardRender,
            float reflectorIntensity,
            bool reflectorOn,
            Vector3 reflectorDirection,
            Vector3 reflectorUp,
            float reflectorConeMaxAngleCos,
            Color reflectorColor,
            float reflectorRange,
            float reflectorFalloff,
            string reflectorTexture,
            float shadowDistance,
            bool castShadows,
            bool glareOn,
            MyGlareTypeEnum glareType,
            float glareSize,
            float glareQuerySize,
            float glareIntensity,
            string glareMaterial,
            float glareMaxDistance
            )
        {
            m_lightType = type;
            GlareOn = glareOn;

            Position = position;
            m_parentID = parentID;

            m_color = color;
            m_specularColor = specularColor;
            m_falloff = falloff;
            m_range = range;
            m_intensity = intensity;
            m_lightOn = lightOn;
            UseInForwardRender = useInForwardRender;
            ReflectorIntensity = reflectorIntensity;
            ReflectorOn = reflectorOn;
            ReflectorDirection = reflectorDirection;
            ReflectorUp = reflectorUp;
            ReflectorConeMaxAngleCos = reflectorConeMaxAngleCos;
            ReflectorColor = reflectorColor;
            ReflectorRange = reflectorRange;
            ReflectorFalloff = reflectorFalloff;
            ShadowDistance = shadowDistance;
            CastShadows = castShadows;

            if (Glare != null)
            {
                Glare.GlareMaterial = glareMaterial;
                Glare.Type = glareType;
                Glare.Size = glareSize;
                System.Diagnostics.Debug.Assert(!GlareOn || (GlareOn && glareQuerySize > 0));
                Glare.QuerySize = glareQuerySize;
                Glare.Intensity = glareIntensity == -1 ? (float?)null : glareIntensity;
                Glare.MaxDistance = glareMaxDistance;
            }

            m_pointBoundingSphere.Radius = range;

            m_reflectorTexture = string.IsNullOrEmpty(reflectorTexture) ? null : MyTextureManager.GetTexture<MyTexture2D>(reflectorTexture);
            PointLightOffset = offset;

            UpdatePositionWithOffset();

            UpdateSpotParams();

        }
Example #11
0
        public void UpdateParameters(
            LightTypeEnum type,
            Vector3D position,
            int parentID,
            float offset,
            Color color,
            Color specularColor,
            float falloff,
            float range,
            float intensity,
            bool lightOn,
            bool useInForwardRender,
            float reflectorIntensity,
            bool reflectorOn,
            Vector3 reflectorDirection,
            Vector3 reflectorUp,
            float reflectorConeMaxAngleCos,
            Color reflectorColor,
            float reflectorRange,
            float reflectorFalloff,
            string reflectorTexture,
            float shadowDistance,
            bool castShadows,
            bool glareOn,
            MyGlareTypeEnum glareType,
            float glareSize,
            float glareQuerySize,
            float glareIntensity,
            string glareMaterial,
            float glareMaxDistance
            )
        {
            m_lightType = type;
            GlareOn     = glareOn;

            Position   = position;
            m_parentID = parentID;

            m_color                  = color;
            m_specularColor          = specularColor;
            m_falloff                = falloff;
            m_range                  = range;
            m_intensity              = intensity;
            m_lightOn                = lightOn;
            UseInForwardRender       = useInForwardRender;
            ReflectorIntensity       = reflectorIntensity;
            ReflectorOn              = reflectorOn;
            ReflectorDirection       = reflectorDirection;
            ReflectorUp              = reflectorUp;
            ReflectorConeMaxAngleCos = reflectorConeMaxAngleCos;
            ReflectorColor           = reflectorColor;
            ReflectorRange           = reflectorRange;
            ReflectorFalloff         = reflectorFalloff;
            ShadowDistance           = shadowDistance;
            CastShadows              = castShadows;

            if (Glare != null)
            {
                Glare.GlareMaterial = glareMaterial;
                Glare.Type          = glareType;
                Glare.Size          = glareSize;
                System.Diagnostics.Debug.Assert(!GlareOn || (GlareOn && glareQuerySize > 0));
                Glare.QuerySize   = glareQuerySize;
                Glare.Intensity   = glareIntensity == -1 ? (float?)null : glareIntensity;
                Glare.MaxDistance = glareMaxDistance;
            }

            m_pointBoundingSphere.Radius = range;

            m_reflectorTexture = string.IsNullOrEmpty(reflectorTexture) ? null : MyTextureManager.GetTexture <MyTexture2D>(reflectorTexture);
            PointLightOffset   = offset;

            UpdatePositionWithOffset();

            UpdateSpotParams();
        }