/// <summary>
        /// Constructor
        /// </summary>
        /// <param name="graphics">Graphics device</param>
        /// <param name="effect">Effect code</param>
        /// <param name="compile">Compile code</param>
        public EffectDefaultGpuParticles(Graphics graphics, byte[] effect, bool compile)
            : base(graphics, effect, compile)
        {
            this.ParticleStreamOut = this.Effect.GetTechniqueByName("ParticleStreamOut");
            this.NonRotationDraw   = this.Effect.GetTechniqueByName("NonRotationParticle");
            this.RotationDraw      = this.Effect.GetTechniqueByName("RotationParticle");

            this.worldVar = this.Effect.GetVariableMatrix("gWorld");
            this.worldViewProjectionVar = this.Effect.GetVariableMatrix("gWorldViewProjection");
            this.eyePositionWorldVar    = this.Effect.GetVariableVector("gEyePositionWorld");
            this.totalTimeVar           = this.Effect.GetVariableScalar("gTotalTime");
            this.elapsedTimeVar         = this.Effect.GetVariableScalar("gElapsedTime");
            this.textureCountVar        = this.Effect.GetVariableScalar("gTextureCount");
            this.textureArrayVar        = this.Effect.GetVariableTexture("gTextureArray");

            this.emissionRateVar        = this.Effect.GetVariableScalar("gEmissionRate");
            this.velocitySensitivityVar = this.Effect.GetVariableScalar("gVelocitySensitivity");
            this.horizontalVelocityVar  = this.Effect.GetVariableVector("gHorizontalVelocity");
            this.verticalVelocityVar    = this.Effect.GetVariableVector("gVerticalVelocity");
            this.randomValuesVar        = this.Effect.GetVariableVector("gRandomValues");

            this.maxDurationVar           = this.Effect.GetVariableScalar("gMaxDuration");
            this.maxDurationRandomnessVar = this.Effect.GetVariableScalar("gMaxDurationRandomness");
            this.endVelocityVar           = this.Effect.GetVariableScalar("gEndVelocity");
            this.gravityVar     = this.Effect.GetVariableVector("gGravity");
            this.startSizeVar   = this.Effect.GetVariableVector("gStartSize");
            this.endSizeVar     = this.Effect.GetVariableVector("gEndSize");
            this.minColorVar    = this.Effect.GetVariableVector("gMinColor");
            this.maxColorVar    = this.Effect.GetVariableVector("gMaxColor");
            this.rotateSpeedVar = this.Effect.GetVariableVector("gRotateSpeed");
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="graphics">Graphics device</param>
        /// <param name="effect">Effect code</param>
        /// <param name="compile">Compile code</param>
        public EffectDeferredTerrain(Graphics graphics, byte[] effect, bool compile)
            : base(graphics, effect, compile)
        {
            this.TerrainAlphaMapDeferred = this.Effect.GetTechniqueByName("TerrainAlphaMapDeferred");
            this.TerrainSlopesDeferred   = this.Effect.GetTechniqueByName("TerrainSlopesDeferred");
            this.TerrainFullDeferred     = this.Effect.GetTechniqueByName("TerrainFullDeferred");

            this.worldVar = this.Effect.GetVariableMatrix("gVSWorld");
            this.worldViewProjectionVar = this.Effect.GetVariableMatrix("gVSWorldViewProjection");
            this.textureResolutionVar   = this.Effect.GetVariableScalar("gVSTextureResolution");

            this.diffuseMapLRVar  = this.Effect.GetVariableTexture("gPSDiffuseMapLRArray");
            this.diffuseMapHRVar  = this.Effect.GetVariableTexture("gPSDiffuseMapHRArray");
            this.normalMapVar     = this.Effect.GetVariableTexture("gPSNormalMapArray");
            this.specularMapVar   = this.Effect.GetVariableTexture("gPSSpecularMapArray");
            this.colorTexturesVar = this.Effect.GetVariableTexture("gPSColorTextureArray");
            this.alphaMapVar      = this.Effect.GetVariableTexture("gPSAlphaTexture");
            this.parametersVar    = this.Effect.GetVariableVector("gPSParams");
            this.materialIndexVar = this.Effect.GetVariableScalar("gPSMaterialIndex");

            //Samplers
            this.samplerDiffuseVar  = this.Effect.GetVariableSampler("SamplerDiffuse");
            this.samplerSpecularVar = this.Effect.GetVariableSampler("SamplerSpecular");
            this.samplerNormalVar   = this.Effect.GetVariableSampler("SamplerNormal");

            //Initialize states
            this.samplerPoint       = EngineSamplerState.Point(graphics);
            this.samplerLinear      = EngineSamplerState.Linear(graphics);
            this.samplerAnisotropic = EngineSamplerState.Anisotropic(graphics, 8);
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="graphics">Graphics device</param>
        /// <param name="effect">Effect code</param>
        /// <param name="compile">Compile code</param>
        public EffectDeferredComposer(Graphics graphics, byte[] effect, bool compile)
            : base(graphics, effect, compile)
        {
            this.DeferredDirectionalLight = this.Effect.GetTechniqueByName("DeferredDirectionalLight");
            this.DeferredPointStencil     = this.Effect.GetTechniqueByName("DeferredPointStencil");
            this.DeferredPointLight       = this.Effect.GetTechniqueByName("DeferredPointLight");
            this.DeferredSpotStencil      = this.Effect.GetTechniqueByName("DeferredSpotStencil");
            this.DeferredSpotLight        = this.Effect.GetTechniqueByName("DeferredSpotLight");
            this.DeferredCombineLights    = this.Effect.GetTechniqueByName("DeferredCombineLights");

            this.worldVar = this.Effect.GetVariableMatrix("gWorld");
            this.worldViewProjectionVar = this.Effect.GetVariableMatrix("gWorldViewProjection");
            this.eyePositionWorldVar    = this.Effect.GetVariableVector("gEyePositionWorld");
            this.directionalLightVar    = this.Effect.GetVariable("gDirLight");
            this.pointLightVar          = this.Effect.GetVariable("gPointLight");
            this.spotLightVar           = this.Effect.GetVariable("gSpotLight");
            this.hemisphericLightVar    = this.Effect.GetVariable("gHemiLight");
            this.fogStartVar            = this.Effect.GetVariableScalar("gFogStart");
            this.fogRangeVar            = this.Effect.GetVariableScalar("gFogRange");
            this.fogColorVar            = this.Effect.GetVariableVector("gFogColor");
            this.tg1MapVar               = this.Effect.GetVariableTexture("gTG1Map");
            this.tg2MapVar               = this.Effect.GetVariableTexture("gTG2Map");
            this.tg3MapVar               = this.Effect.GetVariableTexture("gTG3Map");
            this.lightMapVar             = this.Effect.GetVariableTexture("gLightMap");
            this.materialPaletteWidthVar = this.Effect.GetVariableScalar("gMaterialPaletteWidth");
            this.materialPaletteVar      = this.Effect.GetVariableTexture("gMaterialPalette");
            this.lodVar = this.Effect.GetVariableVector("gLOD");
            this.shadowMapDirectionalVar = this.Effect.GetVariableTexture("gShadowMapDir");
            this.shadowMapPointVar       = this.Effect.GetVariableTexture("gShadowMapPoint");
            this.shadowMapSpotVar        = this.Effect.GetVariableTexture("gShadowMapSpot");
        }
Esempio n. 4
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="graphics">Graphics device</param>
        /// <param name="effect">Effect code</param>
        /// <param name="compile">Compile code</param>
        public EffectDefaultBillboard(Graphics graphics, byte[] effect, bool compile)
            : base(graphics, effect, compile)
        {
            this.ForwardBillboard = this.Effect.GetTechniqueByName("ForwardBillboard");

            this.worldVar = this.Effect.GetVariableMatrix("gWorld");
            this.worldViewProjectionVar  = this.Effect.GetVariableMatrix("gWorldViewProjection");
            this.materialIndexVar        = this.Effect.GetVariableScalar("gMaterialIndex");
            this.hemiLightVar            = this.Effect.GetVariable("gPSHemiLight");
            this.dirLightsVar            = this.Effect.GetVariable("gDirLights");
            this.pointLightsVar          = this.Effect.GetVariable("gPointLights");
            this.spotLightsVar           = this.Effect.GetVariable("gSpotLights");
            this.lightCountVar           = this.Effect.GetVariableVector("gLightCount");
            this.eyePositionWorldVar     = this.Effect.GetVariableVector("gEyePositionWorld");
            this.fogStartVar             = this.Effect.GetVariableScalar("gFogStart");
            this.fogRangeVar             = this.Effect.GetVariableScalar("gFogRange");
            this.fogColorVar             = this.Effect.GetVariableVector("gFogColor");
            this.startRadiusVar          = this.Effect.GetVariableScalar("gStartRadius");
            this.endRadiusVar            = this.Effect.GetVariableScalar("gEndRadius");
            this.textureCountVar         = this.Effect.GetVariableScalar("gTextureCount");
            this.normalMapCountVar       = this.Effect.GetVariableScalar("gNormalMapCount");
            this.texturesVar             = this.Effect.GetVariableTexture("gTextureArray");
            this.normalMapsVar           = this.Effect.GetVariableTexture("gNormalMapArray");
            this.textureRandomVar        = this.Effect.GetVariableTexture("gTextureRandom");
            this.materialPaletteWidthVar = this.Effect.GetVariableScalar("gMaterialPaletteWidth");
            this.materialPaletteVar      = this.Effect.GetVariableTexture("gMaterialPalette");
            this.lodVar = this.Effect.GetVariableVector("gLOD");
            this.shadowMapDirectionalVar = this.Effect.GetVariableTexture("gShadowMapDir");
            this.shadowMapPointVar       = this.Effect.GetVariableTexture("gShadowMapPoint");
            this.shadowMapSpotVar        = this.Effect.GetVariableTexture("gShadowMapSpot");
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="graphics">Graphics device</param>
        /// <param name="effect">Effect code</param>
        /// <param name="compile">Compile code</param>
        public EffectDefaultTerrain(Graphics graphics, byte[] effect, bool compile)
            : base(graphics, effect, compile)
        {
            this.TerrainAlphaMapForward = this.Effect.GetTechniqueByName("TerrainAlphaMapForward");
            this.TerrainSlopesForward   = this.Effect.GetTechniqueByName("TerrainSlopesForward");
            this.TerrainFullForward     = this.Effect.GetTechniqueByName("TerrainFullForward");

            //Globals
            this.materialPaletteWidthVar = this.Effect.GetVariableScalar("gMaterialPaletteWidth");
            this.materialPaletteVar      = this.Effect.GetVariableTexture("gMaterialPalette");
            this.lodVar = this.Effect.GetVariableVector("gLOD");

            //Per frame
            this.worldVar = this.Effect.GetVariableMatrix("gVSWorld");
            this.worldViewProjectionVar = this.Effect.GetVariableMatrix("gVSWorldViewProjection");
            this.textureResolutionVar   = this.Effect.GetVariableScalar("gVSTextureResolution");

            this.eyePositionWorldVar     = this.Effect.GetVariableVector("gPSEyePositionWorld");
            this.lightCountVar           = this.Effect.GetVariableVector("gPSLightCount");
            this.fogColorVar             = this.Effect.GetVariableVector("gPSFogColor");
            this.fogStartVar             = this.Effect.GetVariableScalar("gPSFogStart");
            this.fogRangeVar             = this.Effect.GetVariableScalar("gPSFogRange");
            this.hemiLightVar            = this.Effect.GetVariable("gPSHemiLight");
            this.dirLightsVar            = this.Effect.GetVariable("gPSDirLights");
            this.pointLightsVar          = this.Effect.GetVariable("gPSPointLights");
            this.spotLightsVar           = this.Effect.GetVariable("gPSSpotLights");
            this.shadowMapDirectionalVar = this.Effect.GetVariableTexture("gPSShadowMapDir");
            this.shadowMapPointVar       = this.Effect.GetVariableTexture("gPSShadowMapPoint");
            this.shadowMapSpotVar        = this.Effect.GetVariableTexture("gPSShadowMapSpot");

            //Per object
            this.parametersVar       = this.Effect.GetVariableVector("gPSParams");
            this.useColorDiffuseVar  = this.Effect.GetVariableScalar("gPSUseColorDiffuse");
            this.useColorSpecularVar = this.Effect.GetVariableScalar("gPSUseColorSpecular");
            this.materialIndexVar    = this.Effect.GetVariableScalar("gPSMaterialIndex");
            this.normalMapVar        = this.Effect.GetVariableTexture("gPSNormalMapArray");
            this.specularMapVar      = this.Effect.GetVariableTexture("gPSSpecularMapArray");
            this.colorTexturesVar    = this.Effect.GetVariableTexture("gPSColorTextureArray");
            this.alphaMapVar         = this.Effect.GetVariableTexture("gPSAlphaTexture");
            this.diffuseMapLRVar     = this.Effect.GetVariableTexture("gPSDiffuseMapLRArray");
            this.diffuseMapHRVar     = this.Effect.GetVariableTexture("gPSDiffuseMapHRArray");

            //Samplers
            this.samplerDiffuseVar  = this.Effect.GetVariableSampler("SamplerDiffuse");
            this.samplerSpecularVar = this.Effect.GetVariableSampler("SamplerSpecular");
            this.samplerNormalVar   = this.Effect.GetVariableSampler("SamplerNormal");

            //Initialize states
            this.samplerPoint       = EngineSamplerState.Point(graphics);
            this.samplerLinear      = EngineSamplerState.Linear(graphics);
            this.samplerAnisotropic = EngineSamplerState.Anisotropic(graphics, 8);
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="graphics">Graphics device</param>
        /// <param name="effect">Effect code</param>
        /// <param name="compile">Compile code</param>
        public EffectShadowBillboard(Graphics graphics, byte[] effect, bool compile)
            : base(graphics, effect, compile)
        {
            this.ShadowMapBillboard = this.Effect.GetTechniqueByName("ShadowMapBillboard");

            this.worldViewProjectionVar = this.Effect.GetVariableMatrix("gWorldViewProjection");
            this.eyePositionWorldVar    = this.Effect.GetVariableVector("gEyePositionWorld");
            this.startRadiusVar         = this.Effect.GetVariableScalar("gStartRadius");
            this.endRadiusVar           = this.Effect.GetVariableScalar("gEndRadius");
            this.textureCountVar        = this.Effect.GetVariableScalar("gTextureCount");
            this.texturesVar            = this.Effect.GetVariableTexture("gTextureArray");

            this.textureRandomVar = this.Effect.GetVariableTexture("gTextureRandom");
        }
Esempio n. 7
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="graphics">Graphics device</param>
        /// <param name="effect">Effect code</param>
        /// <param name="compile">Compile code</param>
        protected EffectShadowBase(Graphics graphics, byte[] effect, bool compile)
            : base(graphics, effect, compile)
        {
            this.ShadowMapPositionColor                 = this.Effect.GetTechniqueByName("ShadowMapPositionColor");
            this.ShadowMapPositionColorInstanced        = this.Effect.GetTechniqueByName("ShadowMapPositionColorI");
            this.ShadowMapPositionColorSkinned          = this.Effect.GetTechniqueByName("ShadowMapPositionColorSkinned");
            this.ShadowMapPositionColorSkinnedInstanced = this.Effect.GetTechniqueByName("ShadowMapPositionColorSkinnedI");

            this.ShadowMapPositionNormalColor                 = this.Effect.GetTechniqueByName("ShadowMapPositionNormalColor");
            this.ShadowMapPositionNormalColorInstanced        = this.Effect.GetTechniqueByName("ShadowMapPositionNormalColorI");
            this.ShadowMapPositionNormalColorSkinned          = this.Effect.GetTechniqueByName("ShadowMapPositionNormalColorSkinned");
            this.ShadowMapPositionNormalColorSkinnedInstanced = this.Effect.GetTechniqueByName("ShadowMapPositionNormalColorSkinnedI");

            this.ShadowMapPositionTexture                 = this.Effect.GetTechniqueByName("ShadowMapPositionTexture");
            this.ShadowMapPositionTextureInstanced        = this.Effect.GetTechniqueByName("ShadowMapPositionTextureI");
            this.ShadowMapPositionTextureSkinned          = this.Effect.GetTechniqueByName("ShadowMapPositionTextureSkinned");
            this.ShadowMapPositionTextureSkinnedInstanced = this.Effect.GetTechniqueByName("ShadowMapPositionTextureSkinnedI");

            this.ShadowMapPositionNormalTexture                 = this.Effect.GetTechniqueByName("ShadowMapPositionNormalTexture");
            this.ShadowMapPositionNormalTextureInstanced        = this.Effect.GetTechniqueByName("ShadowMapPositionNormalTextureI");
            this.ShadowMapPositionNormalTextureSkinned          = this.Effect.GetTechniqueByName("ShadowMapPositionNormalTextureSkinned");
            this.ShadowMapPositionNormalTextureSkinnedInstanced = this.Effect.GetTechniqueByName("ShadowMapPositionNormalTextureSkinnedI");

            this.ShadowMapPositionNormalTextureTangent                 = this.Effect.GetTechniqueByName("ShadowMapPositionNormalTextureTangent");
            this.ShadowMapPositionNormalTextureTangentInstanced        = this.Effect.GetTechniqueByName("ShadowMapPositionNormalTextureTangentI");
            this.ShadowMapPositionNormalTextureTangentSkinned          = this.Effect.GetTechniqueByName("ShadowMapPositionNormalTextureTangentSkinned");
            this.ShadowMapPositionNormalTextureTangentSkinnedInstanced = this.Effect.GetTechniqueByName("ShadowMapPositionNormalTextureTangentSkinnedI");

            this.ShadowMapPositionTextureTransparent                 = this.Effect.GetTechniqueByName("ShadowMapPositionTextureTransparent");
            this.ShadowMapPositionTextureTransparentInstanced        = this.Effect.GetTechniqueByName("ShadowMapPositionTextureTransparentI");
            this.ShadowMapPositionTextureTransparentSkinned          = this.Effect.GetTechniqueByName("ShadowMapPositionTextureTransparentSkinned");
            this.ShadowMapPositionTextureTransparentSkinnedInstanced = this.Effect.GetTechniqueByName("ShadowMapPositionTextureTransparentSkinnedI");

            this.ShadowMapPositionNormalTextureTransparent                 = this.Effect.GetTechniqueByName("ShadowMapPositionNormalTextureTransparent");
            this.ShadowMapPositionNormalTextureTransparentInstanced        = this.Effect.GetTechniqueByName("ShadowMapPositionNormalTextureTransparentI");
            this.ShadowMapPositionNormalTextureTransparentSkinned          = this.Effect.GetTechniqueByName("ShadowMapPositionNormalTextureTransparentSkinned");
            this.ShadowMapPositionNormalTextureTransparentSkinnedInstanced = this.Effect.GetTechniqueByName("ShadowMapPositionNormalTextureTransparentSkinnedI");

            this.ShadowMapPositionNormalTextureTangentTransparent                 = this.Effect.GetTechniqueByName("ShadowMapPositionNormalTextureTangentTransparent");
            this.ShadowMapPositionNormalTextureTangentTransparentInstanced        = this.Effect.GetTechniqueByName("ShadowMapPositionNormalTextureTangentTransparentI");
            this.ShadowMapPositionNormalTextureTangentTransparentSkinned          = this.Effect.GetTechniqueByName("ShadowMapPositionNormalTextureTangentTransparentSkinned");
            this.ShadowMapPositionNormalTextureTangentTransparentSkinnedInstanced = this.Effect.GetTechniqueByName("ShadowMapPositionNormalTextureTangentTransparentSkinnedI");

            this.AnimationPaletteWidthVariable = this.Effect.GetVariableScalar("gAnimationPaletteWidth");
            this.AnimationPaletteVariable      = this.Effect.GetVariableTexture("gAnimationPalette");
            this.WorldViewProjectionVariable   = this.Effect.GetVariableMatrix("gVSWorldViewProjection");
            this.AnimationOffsetVariable       = this.Effect.GetVariableScalar("gVSAnimationOffset");
            this.DiffuseMapVariable            = this.Effect.GetVariableTexture("gPSDiffuseMapArray");
            this.TextureIndexVariable          = this.Effect.GetVariableScalar("gPSTextureIndex");
        }
Esempio n. 8
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="graphics">Graphics device</param>
        /// <param name="effect">Effect code</param>
        /// <param name="compile">Compile code</param>
        public EffectDefaultSkyScattering(Graphics graphics, byte[] effect, bool compile)
            : base(graphics, effect, compile)
        {
            this.SkyScatteringLow    = this.Effect.GetTechniqueByName("SkyScatteringLow");
            this.SkyScatteringMedium = this.Effect.GetTechniqueByName("SkyScatteringMedium");
            this.SkyScatteringHigh   = this.Effect.GetTechniqueByName("SkyScatteringHigh");

            this.worldViewProjectionVar    = this.Effect.GetVariableMatrix("gWorldViewProjection");
            this.sphereRadiiVar            = this.Effect.GetVariableVector("gSphereRadii");
            this.scatteringCoefficientsVar = this.Effect.GetVariableVector("gScatteringCoeffs");
            this.inverseWaveLengthVar      = this.Effect.GetVariableVector("gInvWaveLength");
            this.miscVar                = this.Effect.GetVariableVector("gMisc");
            this.backColorVar           = this.Effect.GetVariableVector("gBackColor");
            this.lightDirectionWorldVar = this.Effect.GetVariableVector("gLightDirection");
            this.hdrExposureVar         = this.Effect.GetVariableScalar("gHDRExposure");
        }
Esempio n. 9
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="graphics">Graphics device</param>
        /// <param name="effect">Effect code</param>
        /// <param name="compile">Compile code</param>
        public EffectDefaultSprite(Graphics graphics, byte[] effect, bool compile)
            : base(graphics, effect, compile)
        {
            this.PositionColor          = this.Effect.GetTechniqueByName("PositionColor");
            this.PositionTexture        = this.Effect.GetTechniqueByName("PositionTexture");
            this.PositionTextureNOALPHA = this.Effect.GetTechniqueByName("PositionTextureNOALPHA");
            this.PositionTextureRED     = this.Effect.GetTechniqueByName("PositionTextureRED");
            this.PositionTextureGREEN   = this.Effect.GetTechniqueByName("PositionTextureGREEN");
            this.PositionTextureBLUE    = this.Effect.GetTechniqueByName("PositionTextureBLUE");
            this.PositionTextureALPHA   = this.Effect.GetTechniqueByName("PositionTextureALPHA");

            this.worldVar = this.Effect.GetVariableMatrix("gWorld");
            this.worldViewProjectionVar = this.Effect.GetVariableMatrix("gWorldViewProjection");
            this.textureIndexVar        = this.Effect.GetVariableScalar("gTextureIndex");
            this.colorVar    = this.Effect.GetVariableVector("gColor");
            this.texturesVar = this.Effect.GetVariableTexture("gTextureArray");
        }
Esempio n. 10
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="graphics">Graphics device</param>
        /// <param name="effect">Effect code</param>
        /// <param name="compile">Compile code</param>
        public EffectDeferredBasic(Graphics graphics, byte[] effect, bool compile)
            : base(graphics, effect, compile)
        {
            this.PositionColor                                 = this.Effect.GetTechniqueByName("PositionColor");
            this.PositionColorSkinned                          = this.Effect.GetTechniqueByName("PositionColorSkinned");
            this.PositionNormalColor                           = this.Effect.GetTechniqueByName("PositionNormalColor");
            this.PositionNormalColorSkinned                    = this.Effect.GetTechniqueByName("PositionNormalColorSkinned");
            this.PositionTexture                               = this.Effect.GetTechniqueByName("PositionTexture");
            this.PositionTextureSkinned                        = this.Effect.GetTechniqueByName("PositionTextureSkinned");
            this.PositionNormalTexture                         = this.Effect.GetTechniqueByName("PositionNormalTexture");
            this.PositionNormalTextureSkinned                  = this.Effect.GetTechniqueByName("PositionNormalTextureSkinned");
            this.PositionNormalTextureTangent                  = this.Effect.GetTechniqueByName("PositionNormalTextureTangent");
            this.PositionNormalTextureTangentSkinned           = this.Effect.GetTechniqueByName("PositionNormalTextureTangentSkinned");
            this.InstancingPositionColor                       = this.Effect.GetTechniqueByName("PositionColorI");
            this.InstancingPositionColorSkinned                = this.Effect.GetTechniqueByName("PositionColorSkinnedI");
            this.InstancingPositionNormalColor                 = this.Effect.GetTechniqueByName("PositionNormalColorI");
            this.InstancingPositionNormalColorSkinned          = this.Effect.GetTechniqueByName("PositionNormalColorSkinnedI");
            this.InstancingPositionTexture                     = this.Effect.GetTechniqueByName("PositionTextureI");
            this.InstancingPositionTextureSkinned              = this.Effect.GetTechniqueByName("PositionTextureSkinnedI");
            this.InstancingPositionNormalTexture               = this.Effect.GetTechniqueByName("PositionNormalTextureI");
            this.InstancingPositionNormalTextureSkinned        = this.Effect.GetTechniqueByName("PositionNormalTextureSkinnedI");
            this.InstancingPositionNormalTextureTangent        = this.Effect.GetTechniqueByName("PositionNormalTextureTangentI");
            this.InstancingPositionNormalTextureTangentSkinned = this.Effect.GetTechniqueByName("PositionNormalTextureTangentSkinnedI");

            this.worldVar = this.Effect.GetVariableMatrix("gWorld");
            this.worldViewProjectionVar   = this.Effect.GetVariableMatrix("gWorldViewProjection");
            this.animationOffsetVar       = this.Effect.GetVariableScalar("gAnimationOffset");
            this.materialIndexVar         = this.Effect.GetVariableScalar("gMaterialIndex");
            this.textureIndexVar          = this.Effect.GetVariableScalar("gTextureIndex");
            this.diffuseMapVar            = this.Effect.GetVariableTexture("gDiffuseMapArray");
            this.normalMapVar             = this.Effect.GetVariableTexture("gNormalMapArray");
            this.specularMapVar           = this.Effect.GetVariableTexture("gSpecularMapArray");
            this.animationPaletteWidthVar = this.Effect.GetVariableScalar("gAnimationPaletteWidth");
            this.animationPaletteVar      = this.Effect.GetVariableTexture("gAnimationPalette");

            //Samplers
            this.samplerDiffuseVar = this.Effect.GetVariableSampler("SamplerDiffuse");
            this.samplerNormalVar  = this.Effect.GetVariableSampler("SamplerNormal");

            //Initialize states
            this.samplerLinear      = EngineSamplerState.Linear(graphics);
            this.samplerAnisotropic = EngineSamplerState.Anisotropic(graphics, 4);
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="graphics">Graphics device</param>
        /// <param name="effect">Effect code</param>
        /// <param name="compile">Compile code</param>
        public EffectShadowFoliage(Graphics graphics, byte[] effect, bool compile)
            : base(graphics, effect, compile)
        {
            this.ShadowMapFoliage4  = this.Effect.GetTechniqueByName("ShadowMapFoliage4");
            this.ShadowMapFoliage8  = this.Effect.GetTechniqueByName("ShadowMapFoliage8");
            this.ShadowMapFoliage16 = this.Effect.GetTechniqueByName("ShadowMapFoliage16");

            this.worldViewProjectionVar = this.Effect.GetVariableMatrix("gWorldViewProjection");
            this.eyePositionWorldVar    = this.Effect.GetVariableVector("gEyePositionWorld");
            this.startRadiusVar         = this.Effect.GetVariableScalar("gStartRadius");
            this.endRadiusVar           = this.Effect.GetVariableScalar("gEndRadius");
            this.textureCountVar        = this.Effect.GetVariableScalar("gTextureCount");
            this.texturesVar            = this.Effect.GetVariableTexture("gTextureArray");

            this.windDirectionVar = this.Effect.GetVariableVector("gWindDirection");
            this.windStrengthVar  = this.Effect.GetVariableScalar("gWindStrength");
            this.totalTimeVar     = this.Effect.GetVariableScalar("gTotalTime");
            this.deltaVar         = this.Effect.GetVariableVector("gDelta");
            this.textureRandomVar = this.Effect.GetVariableTexture("gTextureRandom");
        }
Esempio n. 12
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="graphics">Graphics device</param>
        /// <param name="effect">Effect code</param>
        /// <param name="compile">Compile code</param>
        public EffectDefaultClouds(Graphics graphics, byte[] effect, bool compile)
            : base(graphics, effect, compile)
        {
            this.CloudsStatic    = this.Effect.GetTechniqueByName("CloudsStatic");
            this.CloudsPerturbed = this.Effect.GetTechniqueByName("CloudsPerturbed");

            this.firstTextureVar  = this.Effect.GetVariableTexture("gCloudTexture1");
            this.secondTextureVar = this.Effect.GetVariableTexture("gCloudTexture2");

            this.worldViewProjectionVar = this.Effect.GetVariableMatrix("gWorldViewProjection");
            this.brightnessVar          = this.Effect.GetVariableScalar("gBrightness");
            this.colorVar          = this.Effect.GetVariableVector("gColor");
            this.fadingDistanceVar = this.Effect.GetVariableScalar("gFadingDistance");

            this.firstTranslationVar  = this.Effect.GetVariableVector("gFirstTranslation");
            this.secondTranslationVar = this.Effect.GetVariableVector("gSecondTranslation");

            this.translationVar = this.Effect.GetVariableScalar("gTranslation");
            this.scaleVar       = this.Effect.GetVariableScalar("gScale");
        }
Esempio n. 13
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="graphics">Graphics device</param>
        /// <param name="effect">Effect code</param>
        /// <param name="compile">Compile code</param>
        public EffectDefaultWater(Graphics graphics, byte[] effect, bool compile)
            : base(graphics, effect, compile)
        {
            this.Water = this.Effect.GetTechniqueByName("Water");

            this.worldVar = this.Effect.GetVariableMatrix("gVSWorld");
            this.worldViewProjectionVar = this.Effect.GetVariableMatrix("gVSWorldViewProjection");

            this.eyePositionWorldVar = this.Effect.GetVariableVector("gPSEyePositionWorld");
            this.baseColorVar        = this.Effect.GetVariableVector("gPSBaseColor");
            this.waterColorVar       = this.Effect.GetVariableVector("gPSWaterColor");
            this.waveParamsVar       = this.Effect.GetVariableVector("gPSWaveParams");
            this.ambientVar          = this.Effect.GetVariableScalar("gPSAmbient");
            this.fogRangeVar         = this.Effect.GetVariableScalar("gPSFogRange");
            this.fogStartVar         = this.Effect.GetVariableScalar("gPSFogStart");
            this.fogColorVar         = this.Effect.GetVariableVector("gPSFogColor");
            this.totalTimeVar        = this.Effect.GetVariableScalar("gPSTotalTime");
            this.iterParamsVar       = this.Effect.GetVariableVector("gPSIters");
            this.lightCountVar       = this.Effect.GetVariableScalar("gPSLightCount");
            this.dirLightsVar        = this.Effect.GetVariable("gPSDirLights");
        }
Esempio n. 14
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="graphics">Graphics device</param>
        /// <param name="effect">Effect code</param>
        /// <param name="compile">Compile code</param>
        public EffectDefaultBasic(Graphics graphics, byte[] effect, bool compile)
            : base(graphics, effect, compile)
        {
            this.PositionColor                                 = this.Effect.GetTechniqueByName("PositionColor");
            this.PositionColorSkinned                          = this.Effect.GetTechniqueByName("PositionColorSkinned");
            this.PositionNormalColor                           = this.Effect.GetTechniqueByName("PositionNormalColor");
            this.PositionNormalColorSkinned                    = this.Effect.GetTechniqueByName("PositionNormalColorSkinned");
            this.PositionTexture                               = this.Effect.GetTechniqueByName("PositionTexture");
            this.PositionTextureNOALPHA                        = this.Effect.GetTechniqueByName("PositionTextureNOALPHA");
            this.PositionTextureRED                            = this.Effect.GetTechniqueByName("PositionTextureRED");
            this.PositionTextureGREEN                          = this.Effect.GetTechniqueByName("PositionTextureGREEN");
            this.PositionTextureBLUE                           = this.Effect.GetTechniqueByName("PositionTextureBLUE");
            this.PositionTextureALPHA                          = this.Effect.GetTechniqueByName("PositionTextureALPHA");
            this.PositionTextureSkinned                        = this.Effect.GetTechniqueByName("PositionTextureSkinned");
            this.PositionNormalTexture                         = this.Effect.GetTechniqueByName("PositionNormalTexture");
            this.PositionNormalTextureSkinned                  = this.Effect.GetTechniqueByName("PositionNormalTextureSkinned");
            this.PositionNormalTextureTangent                  = this.Effect.GetTechniqueByName("PositionNormalTextureTangent");
            this.PositionNormalTextureTangentSkinned           = this.Effect.GetTechniqueByName("PositionNormalTextureTangentSkinned");
            this.InstancingPositionColor                       = this.Effect.GetTechniqueByName("PositionColorI");
            this.InstancingPositionColorSkinned                = this.Effect.GetTechniqueByName("PositionColorSkinnedI");
            this.InstancingPositionNormalColor                 = this.Effect.GetTechniqueByName("PositionNormalColorI");
            this.InstancingPositionNormalColorSkinned          = this.Effect.GetTechniqueByName("PositionNormalColorSkinnedI");
            this.InstancingPositionTexture                     = this.Effect.GetTechniqueByName("PositionTextureI");
            this.InstancingPositionTextureNOALPHA              = this.Effect.GetTechniqueByName("PositionTextureNOALPHAI");
            this.InstancingPositionTextureRED                  = this.Effect.GetTechniqueByName("PositionTextureREDI");
            this.InstancingPositionTextureGREEN                = this.Effect.GetTechniqueByName("PositionTextureGREENI");
            this.InstancingPositionTextureBLUE                 = this.Effect.GetTechniqueByName("PositionTextureBLUEI");
            this.InstancingPositionTextureALPHA                = this.Effect.GetTechniqueByName("PositionTextureALPHAI");
            this.InstancingPositionTextureSkinned              = this.Effect.GetTechniqueByName("PositionTextureSkinnedI");
            this.InstancingPositionNormalTexture               = this.Effect.GetTechniqueByName("PositionNormalTextureI");
            this.InstancingPositionNormalTextureSkinned        = this.Effect.GetTechniqueByName("PositionNormalTextureSkinnedI");
            this.InstancingPositionNormalTextureTangent        = this.Effect.GetTechniqueByName("PositionNormalTextureTangentI");
            this.InstancingPositionNormalTextureTangentSkinned = this.Effect.GetTechniqueByName("PositionNormalTextureTangentSkinnedI");

            //Globals
            this.animationPaletteWidthVar = this.Effect.GetVariableScalar("gAnimationPaletteWidth");
            this.animationPaletteVar      = this.Effect.GetVariableTexture("gAnimationPalette");
            this.materialPaletteWidthVar  = this.Effect.GetVariableScalar("gMaterialPaletteWidth");
            this.materialPaletteVar       = this.Effect.GetVariableTexture("gMaterialPalette");
            this.lodVar = this.Effect.GetVariableVector("gLOD");

            //Per frame
            this.worldVar = this.Effect.GetVariableMatrix("gVSWorld");
            this.worldViewProjectionVar  = this.Effect.GetVariableMatrix("gVSWorldViewProjection");
            this.eyePositionWorldVar     = this.Effect.GetVariableVector("gPSEyePositionWorld");
            this.hemiLightVar            = this.Effect.GetVariable("gPSHemiLight");
            this.dirLightsVar            = this.Effect.GetVariable("gPSDirLights");
            this.pointLightsVar          = this.Effect.GetVariable("gPSPointLights");
            this.spotLightsVar           = this.Effect.GetVariable("gPSSpotLights");
            this.lightCountVar           = this.Effect.GetVariableVector("gPSLightCount");
            this.fogStartVar             = this.Effect.GetVariableScalar("gPSFogStart");
            this.fogRangeVar             = this.Effect.GetVariableScalar("gPSFogRange");
            this.fogColorVar             = this.Effect.GetVariableVector("gPSFogColor");
            this.shadowMapDirectionalVar = this.Effect.GetVariableTexture("gPSShadowMapDir");
            this.shadowMapPointVar       = this.Effect.GetVariableTexture("gPSShadowMapPoint");
            this.shadowMapSpotVar        = this.Effect.GetVariableTexture("gPSShadowMapSpot");

            //Per object
            this.useColorDiffuseVar  = this.Effect.GetVariableScalar("gPSUseColorDiffuse");
            this.useColorSpecularVar = this.Effect.GetVariableScalar("gPSUseColorSpecular");
            this.diffuseMapVar       = this.Effect.GetVariableTexture("gPSDiffuseMapArray");
            this.normalMapVar        = this.Effect.GetVariableTexture("gPSNormalMapArray");
            this.specularMapVar      = this.Effect.GetVariableTexture("gPSSpecularMapArray");

            //Per instance
            this.animationOffsetVar = this.Effect.GetVariableScalar("gVSAnimationOffset");
            this.materialIndexVar   = this.Effect.GetVariableScalar("gPSMaterialIndex");
            this.textureIndexVar    = this.Effect.GetVariableScalar("gPSTextureIndex");

            //Samplers
            this.samplerDiffuseVar  = this.Effect.GetVariableSampler("SamplerDiffuse");
            this.samplerSpecularVar = this.Effect.GetVariableSampler("SamplerSpecular");
            this.samplerNormalVar   = this.Effect.GetVariableSampler("SamplerNormal");

            //Initialize states
            this.samplerPoint       = EngineSamplerState.Point(graphics);
            this.samplerLinear      = EngineSamplerState.Linear(graphics);
            this.samplerAnisotropic = EngineSamplerState.Anisotropic(graphics, 4);
        }