public bool AffectsFaceGroup(StaticFaceGroup faceGroup, ManualCullingMode cullMode)
        {
            bool  affects = false;
            float lightDist = 0, angle;

            if (this.Type == LightType.Directional)
            {
                angle = faceGroup.plane.Normal.Dot(this.DerivedDirection);

                if (cullMode != ManualCullingMode.None)
                {
                    if (((angle < 0) && (cullMode == ManualCullingMode.Front)) ||
                        ((angle > 0) && (cullMode == ManualCullingMode.Back)))
                    {
                        return(false);
                    }
                }
            }
            else
            {
                lightDist = faceGroup.plane.GetDistance(this.DerivedPosition);

                if (cullMode != ManualCullingMode.None)
                {
                    if (((lightDist < 0) && (cullMode == ManualCullingMode.Back)) ||
                        ((lightDist > 0) && (cullMode == ManualCullingMode.Front)))
                    {
                        return(false);
                    }
                }
            }

            switch (this.Type)
            {
            case LightType.Directional:
                affects = true;
                break;

            case LightType.Point:
                if (MathUtil.Abs(lightDist) < range)
                {
                    affects = true;
                }
                break;

            case LightType.Spotlight:
                if (MathUtil.Abs(lightDist) < range)
                {
                    angle = faceGroup.plane.Normal.Dot(this.DerivedDirection);
                    if (((lightDist < 0 && angle > 0) || (lightDist > 0 && angle < 0)) &&
                        MathUtil.Abs(angle) >= MathUtil.Cos(this.spotOuter * 0.5f))
                    {
                        affects = true;
                    }
                }
                break;
            }

            return(affects);
        }
Example #2
0
 /// <summary>
 ///		Default constructor - used by <see cref="Quake3ShaderManager"/> (do not call directly)
 /// </summary>
 /// <param name="name">Shader name.</param>
 public Quake3Shader(ResourceManager parent, string name, ResourceHandle handle, string group)
     : base(parent, name, handle, group)
 {
     DeformFunc        = ShaderDeformFunc.None;
     DeformParams      = new float[5];
     this._cullingMode = ManualCullingMode.Back;
     this._pass        = new List <ShaderPass>();
 }
Example #3
0
 public void setManualCullingMode(ManualCullingMode mode)
 {
     OgrePINVOKE.Technique_setManualCullingMode(swigCPtr, (int)mode);
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
 /// <summary>
 ///		Default constructor - used by <see cref="Quake3ShaderManager"/> (do not call directly)
 /// </summary>
 /// <param name="name">Shader name.</param>
 public Quake3Shader(string name)
 {
     this.name    = name;
     deformFunc   = ShaderDeformFunc.None;
     deformParams = new float[5];
     cullMode     = ManualCullingMode.Back;
     pass         = new ShaderPassCollection();
 }
Example #5
0
		/// <summary>
		///    Default constructor.
		/// </summary>
		/// <param name="parent">Technique that owns this Pass.</param>
		/// <param name="index">Index of this pass.</param>
		public Pass( Technique parent, int index )
		{
			this._parent = parent;
			this._index = index;

			lock ( passLock )
			{
				this.passId = nextPassId++;
			}

			// color defaults
			_ambient = ColorEx.White;
			_diffuse = ColorEx.White;
			_specular = ColorEx.Black;
			_emissive = ColorEx.Black;

			// by default, don't override the scene's fog settings
			_fogOverride = false;
			_fogMode = FogMode.None;
			_fogColor = ColorEx.White;
			_fogStart = 0;
			_fogEnd = 1;
			_fogDensity = 0.001f;

			// default blending (overwrite)
			_sourceBlendFactor = SceneBlendFactor.One;
			_destinationBlendFactor = SceneBlendFactor.Zero;



			// depth buffer settings
			_depthCheck = true;
			_depthWrite = true;
			_colorWriteEnabled = true;
			_depthFunction = CompareFunction.LessEqual;

			// cull settings
			_cullingMode = CullingMode.Clockwise;
			_manualCullingMode = ManualCullingMode.Back;

			// light settings
			_lightingEnabled = true;
			_runOnlyForOneLightType = true;
			_onlyLightType = LightType.Point;
			_shadingMode = Shading.Gouraud;

			// Default max lights to the global max
			_maxSimultaneousLights = Config.MaxSimultaneousLights;

			_name = index.ToString();

            IterationCount = 1;

			DirtyHash();
		}
Example #6
0
		public bool AffectsFaceGroup( StaticFaceGroup faceGroup, ManualCullingMode cullMode )
		{
			bool affects = false;
			float lightDist = 0, angle;

			if ( this.Type == LightType.Directional )
			{
				angle = faceGroup.plane.Normal.Dot( this.DerivedDirection );

				if ( cullMode != ManualCullingMode.None )
				{
					if ( ( ( angle < 0 ) && ( cullMode == ManualCullingMode.Front ) ) ||
						( ( angle > 0 ) && ( cullMode == ManualCullingMode.Back ) ) )
						return false;
				}
			}
			else
			{
				lightDist = faceGroup.plane.GetDistance( this.GetDerivedPosition() );

				if ( cullMode != ManualCullingMode.None )
				{
					if ( ( ( lightDist < 0 ) && ( cullMode == ManualCullingMode.Back ) ) ||
						( ( lightDist > 0 ) && ( cullMode == ManualCullingMode.Front ) ) )
						return false;
				}
			}

			switch ( this.Type )
			{
				case LightType.Directional:
					affects = true;
					break;

				case LightType.Point:
					if ( Utility.Abs( lightDist ) < range )
						affects = true;
					break;

				case LightType.Spotlight:
					if ( Utility.Abs( lightDist ) < range )
					{
						angle = faceGroup.plane.Normal.Dot( this.DerivedDirection );
						if ( ( ( lightDist < 0 && angle > 0 ) || ( lightDist > 0 && angle < 0 ) ) &&
							Utility.Abs( angle ) >= Utility.Cos( this.spotOuter * 0.5f ) )
							affects = true;
					}
					break;
			}

			return affects;
		}
 /// <summary>
 ///		Default constructor - used by <see cref="Quake3ShaderManager"/> (do not call directly)
 /// </summary>
 /// <param name="name">Shader name.</param>
 public Quake3Shader(string name)
 {
     this.name = name;
     deformFunc = ShaderDeformFunc.None;
     deformParams = new float[5];
     cullMode = ManualCullingMode.Back;
     pass = new ShaderPassCollection();
 }
Example #8
0
		/// <summary>
		///		Default constructor - used by <see cref="Quake3ShaderManager"/> (do not call directly)
		/// </summary>
		/// <param name="name">Shader name.</param>
		public Quake3Shader( ResourceManager parent, string name, ResourceHandle handle, string group )
			: base( parent, name, handle, group )
		{
			DeformFunc = ShaderDeformFunc.None;
			DeformParams = new float[5];
			this._cullingMode = ManualCullingMode.Back;
			this._pass = new List<ShaderPass>();
		}
Example #9
0
        /// <summary>
        ///    Default constructor.
        /// </summary>
        /// <param name="parent">Technique that owns this Pass.</param>
        /// <param name="index">Index of this pass.</param>
        public Pass(Technique parent, int index)
        {
            this.parent = parent;
            this.index = index;

            lock (passLock) {
                this.passId = nextPassId++;
            }

            // color defaults
            ambient = ColorEx.White;
            diffuse = ColorEx.White;
            specular = ColorEx.Black;
            emissive = ColorEx.Black;

            // by default, don't override the scene's fog settings
            fogOverride = false;
            fogMode = FogMode.None;
            fogColor = ColorEx.White;
            fogStart = 0;
            fogEnd = 1;
            fogDensity = 0.001f;

            // default blending (overwrite)
            sourceBlendFactor = SceneBlendFactor.One;
            destBlendFactor = SceneBlendFactor.Zero;

            // depth buffer settings
            depthCheck = true;
            depthWrite = true;
            colorWrite = true;
            alphaRejectFunction = CompareFunction.AlwaysPass;
            alphaRejectValue = 0;
            depthFunc = CompareFunction.LessEqual;

            depthBiasConstant = 0f;
            depthBiasSlopeScale = 0f;

            // cull settings
            cullMode = CullingMode.Clockwise;
            manualCullMode = ManualCullingMode.Back;

            // light settings
            lightingEnabled = true;
            runOnlyForOneLightType = true;
            lightsPerIteration = 1;
            runOncePerLight = false;
            onlyLightType = LightType.Point;
            shadeOptions = Shading.Gouraud;

            // Default max lights to the global max
            maxLights = Config.MaxSimultaneousLights;

            // Starting light index
            startLight = 0;

            // Default to solid
            sceneDetail = SceneDetailLevel.Solid;

            // Iteration count of 1
            passIterationCount = 1;

            // pointSize, etc.
            pointSize = 1.0f;
            pointMinSize = 0f;
            pointMaxSize = 0f;
            pointSpritesEnabled = false;
            pointAttenuationEnabled = false;
            pointAttenuationConstant = 1.0f;
            pointAttenuationLinear = 0f;
            pointAttenuationQuadratic = 0f;

            contentTypeLookupBuilt = false;

            name = index.ToString();

            DirtyHash();
        }
Example #10
0
 private static extern void Material_setManualCullingMode(IntPtr material, ManualCullingMode mode);
Example #11
0
 public void setManualCullingMode(ManualCullingMode mode)
 {
     Material_setManualCullingMode(resource, mode);
 }
Example #12
0
 public void setManualCullingMode(ManualCullingMode mode)
 {
     Pass_setManualCullingMode(pass, mode);
 }
Example #13
0
 private static extern void Pass_setManualCullingMode(IntPtr pass, ManualCullingMode mode);
Example #14
0
 private static extern void Technique_setManualCullingMode(IntPtr technique, ManualCullingMode mode);
Example #15
0
 public void setManualCullingMode(ManualCullingMode mode)
 {
     Technique_setManualCullingMode(technique, mode);
 }