예제 #1
0
        public override void Render(RenderContext context)
        {
            if (renderHost.RenderTechnique == renderHost.RenderTechniquesManager.RenderTechniques.Get(DeferredRenderTechniqueNames.Deferred) ||
                renderHost.RenderTechnique == renderHost.RenderTechniquesManager.RenderTechniques.Get(DeferredRenderTechniqueNames.GBuffer))
            {
                return;
            }

            if (this.IsRendering)
            {
                /// --- turn-on the light            
                lightColors[lightIndex] = this.Color;
            }
            else
            {
                // --- turn-off the light
                lightColors[lightIndex] = new global::SharpDX.Color4(0, 0, 0, 0);
            }

            /// --- Set lighting parameters
            lightPositions[lightIndex] = this.Position.ToVector4();                      
            lightAtt[lightIndex] = new Vector4((float)this.Attenuation.X, (float)this.Attenuation.Y, (float)this.Attenuation.Z, (float)this.Range);

            /// --- Update lighting variables    
            this.vLightPos.Set(lightPositions);
            this.vLightColor.Set(lightColors);
            this.vLightAtt.Set(lightAtt);
            this.iLightType.Set(lightTypes);
        }
예제 #2
0
        public static global::SharpDX.Color4 Normalized(this global::SharpDX.Color4 vector)
        {
            var v = vector.ToVector3();

            v.Normalize();
            return(v.ToColor4());
        }
예제 #3
0
        public override void Render(RenderContext context)
        {
#if DEFERRED
            if (renderHost.RenderTechnique == Techniques.RenderDeferred || renderHost.RenderTechnique == Techniques.RenderGBuffer)
            {
                return;
            }
#endif

            if (this.IsRendering)
            {
                /// --- turn-on the light
                lightColors[lightIndex] = this.Color;
            }
            else
            {
                // --- turn-off the light
                lightColors[lightIndex] = new global::SharpDX.Color4(0, 0, 0, 0);
            }

            /// --- Set lighting parameters
            lightPositions[lightIndex] = this.Position.ToVector4();
            lightAtt[lightIndex]       = new Vector4((float)this.Attenuation.X, (float)this.Attenuation.Y, (float)this.Attenuation.Z, (float)this.Range);

            /// --- Update lighting variables
            this.vLightPos.Set(lightPositions);
            this.vLightColor.Set(lightColors);
            this.vLightAtt.Set(lightAtt);
            this.iLightType.Set(lightTypes);
        }
예제 #4
0
        public override void Render(RenderContext context)
        {
            if (renderHost.RenderTechnique == renderHost.RenderTechniquesManager.RenderTechniques.Get(DeferredRenderTechniqueNames.Deferred) ||
                renderHost.RenderTechnique == renderHost.RenderTechniquesManager.RenderTechniques.Get(DeferredRenderTechniqueNames.GBuffer))
            {
                return;
            }

            if (this.IsRendering)
            {
                /// --- turn-on the light
                lightColors[lightIndex] = this.Color;
            }
            else
            {
                // --- turn-off the light
                lightColors[lightIndex] = new global::SharpDX.Color4(0, 0, 0, 0);
            }

            /// --- Set lighting parameters
            lightPositions[lightIndex]  = this.Position.ToVector4();
            lightDirections[lightIndex] = this.Direction.ToVector4();
            lightSpots[lightIndex]      = new Vector4((float)Math.Cos(this.OuterAngle / 360.0 * Math.PI), (float)Math.Cos(this.InnerAngle / 360.0 * Math.PI), (float)this.Falloff, 0);
            lightAtt[lightIndex]        = new Vector4((float)this.Attenuation.X, (float)this.Attenuation.Y, (float)this.Attenuation.Z, (float)this.Range);

            /// --- Update lighting variables
            this.vLightPos.Set(lightPositions);
            this.vLightDir.Set(lightDirections);
            this.vLightSpot.Set(lightSpots);
            this.vLightColor.Set(lightColors);
            this.vLightAtt.Set(lightAtt);
            this.iLightType.Set(lightTypes);
        }
예제 #5
0
        public override void Render(RenderContext context)
        {
#if DEFERRED  
            if (renderHost.RenderTechnique == Techniques.RenderDeferred || renderHost.RenderTechnique == Techniques.RenderGBuffer)
            {
                return;
            }
#endif

            if (this.IsRendering)
            {
                /// --- turn-on the light            
                lightColors[lightIndex] = this.Color;
            }
            else
            {
                // --- turn-off the light
                lightColors[lightIndex] = new global::SharpDX.Color4(0, 0, 0, 0);
            }
          
            /// --- Set lighting parameters
            lightPositions[lightIndex] = this.Position.ToVector4();
            lightDirections[lightIndex] = this.Direction.ToVector4();
            lightSpots[lightIndex] = new Vector4((float)Math.Cos(this.OuterAngle / 360.0 * Math.PI), (float)Math.Cos(this.InnerAngle / 360.0 * Math.PI), (float)this.Falloff, 0);            
            lightAtt[lightIndex] = new Vector4((float)this.Attenuation.X, (float)this.Attenuation.Y, (float)this.Attenuation.Z, (float)this.Range);

            /// --- Update lighting variables    
            this.vLightPos.Set(lightPositions);
            this.vLightDir.Set(lightDirections);
            this.vLightSpot.Set(lightSpots);
            this.vLightColor.Set(lightColors);
            this.vLightAtt.Set(lightAtt);
            this.iLightType.Set(lightTypes);
        }