Example #1
0
 public Element(Vector3 position, float width, float texCoord, ColorEx color)
 {
     Position = position;
     Width    = width;
     TexCoord = texCoord;
     Color    = color;
 }
 public GlobalAmbientLight(IWorldContainer parentContainer, WorldEditor worldEditor)
 {
     this.app = worldEditor;
     this.parent = parentContainer;
     this.scene = app.Scene;
     this.color = app.Config.DefaultAmbientLightColor;
 }
        /// <summary>
        ///		The constructor. Dimensions of the viewport are expressed as a pecentage between
        ///		0 and 100. This allows the dimensions to apply irrespective of
        ///		changes in the target's size: e.g. to fill the whole area,
        ///		values of 0,0,100,100 are appropriate.
        /// </summary>
        /// <param name="camera">Reference to the camera to be the source for the image.</param>
        /// <param name="target">Reference to the render target to be the destination for the rendering.</param>
        /// <param name="left">Left</param>
        /// <param name="top">Top</param>
        /// <param name="width">Width</param>
        /// <param name="height">Height</param>
        /// <param name="zOrder">Relative Z-order on the target. Lower = further to the front.</param>
        public Viewport(Camera camera, RenderTarget target, float left, float top, float width, float height, int zOrder)
        {
            Debug.Assert(camera != null, "Cannot use a null Camera to create a viewport.");
            Debug.Assert(target != null, "Cannor use a null RenderTarget to create a viewport.");

            LogManager.Instance.Write("Creating viewport rendering from camera '{0}', relative dimensions L:{1},T:{2},W:{3},H:{4}, Z-Order:{5}",
                                      camera.Name, left, top, width, height, zOrder);

            this.camera = camera;
            this.target = target;
            this.zOrder = zOrder;

            relativeLeft   = left;
            relativeTop    = top;
            relativeWidth  = width;
            relativeHeight = height;

            backColor       = ColorEx.Black;
            clearEveryFrame = true;
            clearBuffers    = FrameBuffer.Color | FrameBuffer.Depth;

            // Calculate actual dimensions
            UpdateDimensions();

            isUpdated    = true;
            showOverlays = true;
            showSkies    = true;
            showShadows  = true;

            materialSchemeName = MaterialManager.DefaultSchemeName;

            // notify camera
            camera.NotifyViewport(this);
        }
Example #4
0
 public TrailAttributes()
 {
     initialColor = ColorEx.White;
     deltaColor   = ColorEx.Zero;
     initialWidth = 10;
     deltaWidth   = 0;
 }
Example #5
0
			public Element( Vector3 position, float width, float texCoord, ColorEx color )
			{
				Position = position;
				Width = width;
				TexCoord = texCoord;
				Color = color;
			}
Example #6
0
        /// <summary>
        ///		Normal constructor. Should not be called directly, but rather the SceneManager.CreateLight method should be used.
        /// </summary>
        /// <param name="name"></param>
        public Light(string name)
        {
            this.name = name;

            // Default to point light, white diffuse light, linear attenuation, fair range
            type              = LightType.Point;
            diffuse           = ColorEx.White;
            specular          = ColorEx.Black;
            range             = 100000;
            attenuationConst  = 1.0f;
            attenuationLinear = 0.0f;
            attenuationQuad   = 0.0f;

            // Center in world, direction irrelevant but set anyway
            position  = Vector3.Zero;
            direction = Vector3.UnitZ;

            // Default some spot values
            spotInner   = 30.0f;
            spotOuter   = 40.0f;
            spotFalloff = 1.0f;

            localTransformDirty     = false;
            powerScale              = 1.0f;
            customShadowCameraSetup = null;
        }
Example #7
0
			public Element( Vector3 position, float width, float texCoord, ColorEx color )
			{
				this.position = position;
				this.width = width;
				this.texCoord = texCoord;
				this.color = color;
			}
 public GlobalAmbientLight(IWorldContainer parentContainer,WorldEditor worldEditor, SceneManager sceneManager, ColorEx lightColor)
 {
     this.parent = parentContainer;
     this.app = worldEditor;
     this.scene = sceneManager;
     this.color = lightColor;
 }
Example #9
0
 public Element(Vector3 position, float width, float textureCoord, ColorEx color)
 {
     this.position     = position;
     this.width        = width;
     this.textureCoord = textureCoord;
     this.color        = color;
 }
 public AddFogCommand(WorldEditor app, Boundary parent, ColorEx color, float nearin, float farin)
 {
     this.app = app;
     this.parent = parent;
     this.color = color;
     this.near = nearin;
     this.far = farin;
 }
 public GlobalDirectionalLight(WorldEditor worldEditor, IWorldContainer parent, Vector3 lightDir, ColorEx diff, ColorEx spec)
 {
     this.app = worldEditor;
     this.parent = parent;
     this.lightDirection = lightDir;
     this.diffuse = diff;
     this.specular = spec;
 }
 public GlobalFog(IWorldContainer parentContainer, WorldEditor worldEditor)
 {
     this.parent = parentContainer;
     this.app = worldEditor;
     this.scene = app.Scene;
     this.color = app.Config.FogColorDefault;
     this.far = app.Config.FogFarDefault;
     this.near = app.Config.FogNearDefault;
 }
        public ColorInterpolatorAffector()
        {
            this.type = "ColourInterpolator";

            for( int i = 0; i < MAX_STAGES; ++i ) {
                colorAdj[i] = new ColorEx(0.5f, 0.5f, 0.5f, 0.0f);
                timeAdj[i] = 1.0f;
            }
        }
 public DirectionalLight(WorldEditor worldEditor, Boundary parent, Vector3 lightDir, ColorEx diff, ColorEx spec)
 {
     this.app = worldEditor;
     this.parent = parent;
     this.lightDirection = lightDir;
     this.diffuse = diff;
     this.specular = spec;
     this.name = String.Format("{0}-{1}", this.parent.Name, "DirectionalLight");
 }
Example #15
0
        public MultiLights(SceneManager pSceneManager, SceneNode pCamNode, MovingObject pPlayerShip, Int32 pNumberOfLights)
        {
            oldCamLightColor = CamLightColor = new ColorEx(0.13f, 0.1f, 0.05f);
            PlayerLightColor = ColorEx.White;
            camLights = new List<Light>(pNumberOfLights);

            innerLights = (Int32)Math.Round(pNumberOfLights / 3.0f, MidpointRounding.AwayFromZero);
            outerLights = pNumberOfLights - innerLights;

            // create the playership's light.
            playerLight = pSceneManager.CreateLight("playerSpotLight");
            playerLight.Type = LightType.Spotlight;
            playerLight.Diffuse = PlayerLightColor;
            playerLight.Specular = ColorEx.White;
            playerLight.SetSpotlightRange(0.0f, 120.0f);
            playerLight.Direction = Vector3.NegativeUnitZ;

            playerLightNode = pPlayerShip.Node.CreateChildSceneNode();
            playerLightNode.AttachObject(playerLight);
            playerLightNode.Position = new Vector3(0, 0, 0);
            playerLightNode.SetDirection(new Vector3(1, 0, 0), TransformSpace.Local);

            // create the camera spotlights around the camera's direction.
            camInnerLightNode = pCamNode.CreateChildSceneNode();
            camInnerLightNode.Position = new Vector3(0, 0, 0);
            camOuterLightNode = pCamNode.CreateChildSceneNode();
            camOuterLightNode.Position = new Vector3(0, 0, 0);

            for (var i = 0; i < innerLights; i++)
            {
                var light = pSceneManager.CreateLight("camInnerLight " + (i + 1));
                light.Type = LightType.Spotlight;
                light.Diffuse = CamLightColor;
                light.Specular = ColorEx.White;
                light.SetSpotlightRange(0.0f, 25.0f);
                light.Direction = Quaternion.FromAngleAxis(360.0 * i / innerLights * Constants.DegreesToRadians, Vector3.UnitZ) *
                    Quaternion.FromAngleAxis(10.0 * Constants.DegreesToRadians, Vector3.UnitX) *
                    Vector3.NegativeUnitZ;

                camLights.Add(light);
                camInnerLightNode.AttachObject(light);
            }
            for (var i = 0; i < outerLights; i++)
            {
                var light = pSceneManager.CreateLight("camOuterLight " + (i + 1));
                light.Type = LightType.Spotlight;
                light.Diffuse = CamLightColor;
                light.Specular = ColorEx.White;
                light.SetSpotlightRange(0.0f, 25.0f);
                light.Direction = Quaternion.FromAngleAxis(360.0 * i / outerLights * Constants.DegreesToRadians, Vector3.UnitZ) *
                    Quaternion.FromAngleAxis(20.0 * Constants.DegreesToRadians, Vector3.UnitX) *
                    Vector3.NegativeUnitZ;

                camLights.Add(light);
                camOuterLightNode.AttachObject(light);
            }
        }
        /// <summary>
        ///		Parses an array of params and returns a color from it.
        /// </summary>
        /// <param name="val"></param>
        public static ColorEx ParseColor(string[] values)
        {
            ColorEx color = new ColorEx();
            color.r = ParseFloat(values[0]);
            color.g = ParseFloat(values[1]);
            color.b = ParseFloat(values[2]);
            color.a = (values.Length > 3) ? ParseFloat(values[3]) : 1.0f;

            return color;
        }
 /// <summary>
 ///		Normal constructor. Should not be called directly, but rather the SceneManager.CreateLight method should be used.
 /// </summary>
 /// <param name="name"></param>
 public TextureLight(string name, BspSceneManager creator)
     : base(name)
 {
     this.creator = creator;
     isTextureLight = true;
     diffuse = ColorEx.White;
     textureColor = ColorEx.White;
     intensity = LightIntensity.Normal;
     priority = 100;
 }
 public AddDirectionalLightCommand(WorldEditor worldEditor, IWorldContainer parentObject, String objectName, string meshName, ColorEx specular, ColorEx diffuse)
 {
     this.app = worldEditor;
     this.parent =  (Boundary) parentObject;
     this.name = objectName;
     this.meshName = meshName;
     this.specular = specular;
     this.diffuse = diffuse;
     this.scene = app.Scene;
 }
 public GlobalDirectionalLight(IWorldContainer parent, WorldEditor worldEditor)
 {
     this.app = worldEditor;
     this.parent = parent;
     this.diffuse = app.Config.DefaultBoundaryDirectionalLightDiffuse;
     this.specular = app.Config.DefaultBoundaryDirectionalLightSpecular;
     this.azimuth = app.Config.DefaultDirectionalLightAzimuth;
     this.zenith = app.Config.DefaultDirectionalLightZenith;
     this.SetDirection(this.azimuth, this.zenith);
 }
        public static Trail NewTrail(MovingObject pObjectToFollow, Single pMaxWidth, ColorEx pColor)
        {
            if (freeTrails.Count == 0)
            {
                return new Trail(pObjectToFollow, pMaxWidth, pColor);
            }

            var trail = freeTrails.Dequeue();
            trail.Relaunch(pObjectToFollow, pMaxWidth, pColor);
            return trail;
        }
 public PointLight(WorldEditor worldEditor, IWorldContainer parent, SceneManager scene, string name, ColorEx specular, ColorEx diffuse, Vector3 position)
 {
     this.app = worldEditor;
     this.parent = parent;
     this.scene = scene;
     this.name = name;
     this.position = position;
     this.specular = specular;
     this.diffuse = diffuse;
     this.terrainOffset = app.Config.DefaultPointLightHeight;
 }
Example #22
0
        public static ColorEx operator *(ColorEx c, float scale)
        {
            ColorEx result = new ColorEx();

            result.r = c.r * scale;
            result.g = c.g * scale;
            result.b = c.b * scale;
            result.a = c.a * scale;

            return(result);
        }
Example #23
0
 /// <summary>
 ///		Copy constructor.
 /// </summary>
 public ColorEx(ColorEx other)
     : this()
 {
     if (other != null)
     {
         this.a = other.a;
         this.r = other.r;
         this.g = other.g;
         this.b = other.b;
     }
 }
Example #24
0
        public static ColorEx operator -(ColorEx c1, ColorEx c2)
        {
            ColorEx result = new ColorEx();

            result.r = c1.r - c2.r;
            result.g = c1.g - c2.g;
            result.b = c1.b - c2.b;
            result.a = c1.a - c2.a;

            return(result);
        }
Example #25
0
        public static ColorEx operator *(ColorEx c1, ColorEx c2)
        {
            ColorEx result = new ColorEx();

            result.r = c1.r * c2.r;
            result.g = c1.g * c2.g;
            result.b = c1.b * c2.b;
            result.a = c1.a * c2.a;

            return(result);
        }
Example #26
0
        /// <summary>
        ///		Parses an array of params and returns a color from it.
        /// </summary>
        /// <param name="val"></param>
        public static ColorEx ParseColor(string[] values)
        {
            ColorEx color = new ColorEx();

            color.r = ParseFloat(values[0]);
            color.g = ParseFloat(values[1]);
            color.b = ParseFloat(values[2]);
            color.a = (values.Length > 3) ? ParseFloat(values[3]) : 1.0f;

            return(color);
        }
Example #27
0
        // arithmetic operations
        public static ColorEx operator +(ColorEx c1, ColorEx c2)
        {
            ColorEx result = new ColorEx();

            result.r = c1.r + c2.r;
            result.g = c1.g + c2.g;
            result.b = c1.b + c2.b;
            result.a = c1.a + c2.a;

            return(result);
        }
 public AddPointLightCommand(WorldEditor worldEditor, IWorldContainer parentObject, String objectName, string meshName, ColorEx specular, ColorEx diffuse)
 {
     this.app = worldEditor;
     this.parent = parentObject;
     this.name = objectName;
     this.meshName = meshName;
     this.specular = specular;
     this.diffuse = diffuse;
     this.scene = app.Scene;
     placing = true;
 }
        /// <summary>
        ///		Parses an array of params and returns a color from it.
        /// </summary>
        /// <param name="val"></param>
        public static ColorEx ParseColor(string val)
        {
            ColorEx color = new ColorEx();
            string[] vals = val.Split(' ');

            color.r = ParseFloat(vals[0]);
            color.g = ParseFloat(vals[1]);
            color.b = ParseFloat(vals[2]);
            color.a = (vals.Length == 4) ? ParseFloat(vals[3]) : 1.0f;

            return color;
        }
        /// <summary>
        ///    Basic constructor, internal since it should only be created by factories.
        /// </summary>
        /// <param name="name"></param>
        internal TextArea(string name)
            : base(name)
        {
            isTransparent = false;
            alignment = HorizontalAlignment.Left;

            colorTop = ColorEx.White;
            colorBottom = ColorEx.White;
            haveColorsChanged = true;

            charHeight = 0.02f;
            pixelCharHeight = 12;
        }
Example #31
0
        /// <summary>
        ///		Parses an array of params and returns a color from it.
        /// </summary>
        /// <param name="val"></param>
        public static ColorEx ParseColor(string val)
        {
            ColorEx color = new ColorEx();

            string[] vals = val.Split(' ');

            color.r = ParseFloat(vals[0]);
            color.g = ParseFloat(vals[1]);
            color.b = ParseFloat(vals[2]);
            color.a = (vals.Length == 4) ? ParseFloat(vals[3]) : 1.0f;

            return(color);
        }
Example #32
0
        /// <summary>
        ///    Used to compare 2 ColorEx objects for equality.
        /// </summary>
        /// <param name="obj">An instance of a ColorEx object to compare to this instance.</param>
        /// <returns>0 if they are equal, 1 if they are not.</returns>
        public int CompareTo(object obj)
        {
            ColorEx other = obj as ColorEx;

            if (this.a == other.a &&
                this.r == other.r &&
                this.g == other.g &&
                this.b == other.b)
            {
                return(0);
            }

            return(1);
        }
Example #33
0
        public Trail(MovingObject pObjectToFollow, Single pMaxWidth, ColorEx pColor)
        {
            LoopResultStates = new LoopResultStates();

            Chain = new BillboardChain(Methods.GenerateUniqueID.ToString(CultureInfo.InvariantCulture));
            Chain.Material.SetSceneBlending(SceneBlendType.Replace);
            Chain.Material.DepthCheck = false;
            Chain.Material.DepthWrite = false;
            Chain.NumberOfChains = 1;
            Chain.IsVisible = false;
            World.Instance.SceneManager.RootSceneNode.AttachObject(Chain);

            Relaunch(pObjectToFollow, pMaxWidth, pColor);
        }
 public PlantType(WorldEditor app, Grass parent, uint instances, string name, string imageName, float scaleWidthLow, float scaleWidthHi, float scaleHeightLow, float scaleHeightHi, ColorEx color, float colorMultLow, float colorMultHi, float windMagnitude)
 {
     this.app = app;
     this.parent = parent;
     this.instances = instances;
     this.name = name;
     this.imageName = imageName;
     this.scaleWidthLow = scaleWidthLow;
     this.scaleWidthHi = scaleWidthHi;
     this.scaleHeightLow = scaleHeightLow;
     this.scaleHeightHi = scaleHeightHi;
     this.color = color;
     this.colorMultLow = colorMultLow;
     this.colorMultHi = colorMultHi;
     this.windMagnitude = windMagnitude;
 }
        public SceneManager()
            : base("MVSceneManager")
        {
            //
            // TODO: Add constructor logic here
            //

            // set up default shadow parameters
            SetShadowTextureSettings(1024, 1, Axiom.Media.PixelFormat.FLOAT32_R);
            shadowColor = new ColorEx(0.75f, 0.75f, 0.75f);
            shadowFarDistance = 20000;
            shadowDirLightExtrudeDist = 100000;
            ShadowCasterRenderBackFaces = false;

            fogConfig = new FogConfig(this);
            ambientLightConfig = new AmbientLightConfig(this);
        }
        public AddPlantTypeCommand(WorldEditor worldEditorin, Grass parentin, uint instancesin, string namein,
			string imageNamein, float scaleWidthHiin, float scaleWidthLowin, float scaleHeightHiin, float scaleHeightLowin,
			ColorEx colorin, float colorMultHiin, float colorMultLowin, float windMagnitudein)
        {
            this.app = worldEditorin;
            this.parent = parentin;
            this.instances = instancesin;
            this.name = namein;
            this.imageName = imageNamein;
            this.scaleWidthHi = scaleWidthHiin;
            this.scaleWidthLow = scaleWidthLowin;
            this.scaleHeightHi = scaleHeightHiin;
            this.scaleHeightLow = scaleHeightLowin;
            this.colorRGB = colorin;
            this.colorMultHi = colorMultHiin;
            this.colorMultLow = colorMultLowin;
            this.windMagnitude = windMagnitudein;
        }
Example #37
0
        public Ocean(IWorldContainer parentContainer, WorldEditor worldEditor)
        {
            this.parent = parentContainer;
            this.app = worldEditor;

            // set up default parameters
            this.displayOcean = app.Config.DefaultDisplayOcean;
            this.seaLevel = app.Config.DefaultSeaLevel;
            this.waveHeight = app.Config.DefaultWaveHeight;
            this.deepColor = app.Config.DefaultOceanDeepColor;
            this.shallowColor = app.Config.DefaultOceanShallowColor;
            this.bumpScale = app.Config.DefaultOceanBumpScale;
            this.textureScaleX = app.Config.DefaultOceanTextureScaleX;
            this.textureScaleZ = app.Config.DefaultOceanTextureScaleZ;
            this.bumpSpeedX = app.Config.DefaultOceanBumpSpeedX;
            this.bumpSpeedZ = app.Config.DefaultOceanBumpSpeedZ;
            this.useParams = app.Config.DefaultOceanUseParams;
        }
Example #38
0
        public void Clear(FrameBufferType buffers, ColorEx col, Real depth, ushort stencil)
        {
            var rs = Root.Instance.RenderSystem;

            if (rs == null)
            {
                return;
            }

            var currentvp = rs.Viewport;

            rs.Viewport = this;
            rs.ClearFrameBuffer(buffers, col, depth, stencil);
            if (currentvp != null && currentvp != this)
            {
                rs.Viewport = currentvp;
            }
        }
        public EditableImage(string name, int width, int height, PixelFormat format, ColorEx color, int numMipMaps, bool isAlpha)
        {
            this.width = width;
            this.height = height;
            this.format = format;
            this.textureName = name;
            this.numMipMaps = numMipMaps;
            this.isAlpha = isAlpha;

            bytesPerPixel = PixelUtil.GetNumElemBytes(format);
            stride = bytesPerPixel * width;

            pixelData = new byte[width * height * bytesPerPixel];

            // this will pin the buffer
            image = Image.FromDynamicImage(pixelData, width, height, format);

            Fill(0, 0, width, height, color);
        }
        public Request(string url, string textureName, TextureFetchDone doneHandler, int destWidth, int destHeight, bool keepAspect, ColorEx fillColor, string authUser, string authPW, string authDomain)
        {
            this.url = url;
            if (!url.StartsWith("http:"))
            {
                log.ErrorFormat("TextureFetch: only http urls supported: {0}", url);
                throw new Exception("TextureFetch: only http urls supported: " + url);
            }
            this.textureName = textureName;
            this.doneHandler = doneHandler;
            this.destWidth = destWidth;
            this.destHeight = destHeight;
            this.keepAspect = keepAspect;
            this.fillColor = fillColor;

            this.authUser = authUser;
            this.authPW = authPW;
            this.authDomain = authDomain;
        }
Example #41
0
        public MovableText(string name, string caption, string fontName, int charHeight, ColorEx color)
            : base(name)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new AxiomException("Trying to create MovableText without name.");
            }
            if (string.IsNullOrEmpty(caption))
            {
                throw new AxiomException("Trying to create MovableText without caption.");
            }

            this._caption             = caption;
            this._characterHeight     = charHeight;
            this._color               = color;
            this._spaceWidth          = 0;
            this._updateColor         = true;
            this._onTop               = true;
            this._horizontalAlignment = HorizontalAlignment.Center;

            FontName = fontName;
            _setupGeometry();
        }
Example #42
0
		/// <summary>
		///
		/// </summary>
		/// <param name="mode"></param>
		/// <param name="color"></param>
		/// <param name="density"></param>
		public virtual void SetFog( FogMode mode, ColorEx color, float density )
		{
			// set all the fog information
			this.fogMode = mode;
			this.fogColor = color;
			this.fogDensity = density;
			this.fogStart = 0.0f;
			this.fogEnd = 1.0f;
		}
Example #43
0
		/// <summary>
		///		Sets the fogging mode applied to the scene.
		/// </summary>
		/// <remarks>
		///		This method sets up the scene-wide fogging effect. These settings
		///		apply to all geometry rendered, UNLESS the material with which it
		///		is rendered has it's own fog settings (see Material.SetFog).
		/// </remarks>
		/// <param name="mode">Set up the mode of fog as described in the FogMode
		///		enum, or set to FogMode.None to turn off.</param>
		/// <param name="color">The color of the fog. Either set this to the same
		///		as your viewport background color, or to blend in with a skydome or skybox.</param>
		/// <param name="density">The density of the fog in Exp or Exp2.
		///		mode, as a value between 0 and 1. The default is 0.001. </param>
		/// <param name="linearStart">Distance in world units at which linear fog starts to
		///		encroach. Only applicable if mode is</param>
		/// <param name="linearEnd">Distance in world units at which linear fog becomes completely
		///		opaque. Only applicable if mode is</param>
		public virtual void SetFog( FogMode mode, ColorEx color, float density, float linearStart, float linearEnd )
		{
			// set all the fog information
			this.fogMode = mode;
			this.fogColor = color;
			this.fogDensity = density;
			this.fogStart = linearStart;
			this.fogEnd = linearEnd;
		}
Example #44
0
		/// <summary>
		///		Renders the static level geometry tagged in <see cref="Plugin_BSPSceneManager.BspSceneManager.WalkTree"/>.
		/// </summary>
		protected void RenderStaticGeometry()
		{
			// Check should we be rendering
			if ( !SpecialCaseRenderQueueList.IsRenderQueueToBeProcessed( worldGeometryRenderQueueId ) )
			{
				return;
			}
			if ( this.level == null )
			{
				LogManager.Instance.Write( "BSPSceneManager [Warning]: Skip RenderStaticGeometry, no level was set!" );
				return;
			}
			// no world transform required
			targetRenderSystem.WorldMatrix = Matrix4.Identity;

			// Set view / proj
			targetRenderSystem.ViewMatrix = cameraInProgress.ViewMatrix;
			targetRenderSystem.ProjectionMatrix = cameraInProgress.ProjectionMatrix;

			ColorEx bspAmbient = ColorEx.White;

			if ( this.level.BspOptions.ambientEnabled )
			{
				bspAmbient = new ColorEx( ambientColor.r*this.level.BspOptions.ambientRatio,
				                          ambientColor.g*this.level.BspOptions.ambientRatio,
				                          ambientColor.b*this.level.BspOptions.ambientRatio );
			}

			var ambientBlend = new LayerBlendModeEx();
			ambientBlend.blendType = LayerBlendType.Color;
			ambientBlend.operation = LayerBlendOperationEx.Modulate;
			ambientBlend.source1 = LayerBlendSource.Texture;
			ambientBlend.source2 = LayerBlendSource.Manual;
			ambientBlend.colorArg2 = bspAmbient;

			// For each material in turn, cache rendering data & render
			IEnumerator mapEnu = this.matFaceGroupMap.Keys.GetEnumerator();

			bool passIsSet = false;

			while ( mapEnu.MoveNext() )
			{
				// Get Material
				var thisMaterial = (Material)mapEnu.Current;
				List<BspStaticFaceGroup> faceGrp = this.matFaceGroupMap[ thisMaterial ];

				// if one face group is a quake shader then the material is a quake shader
				bool isQuakeShader = faceGrp[ 0 ].isQuakeShader;

				// Empty existing cache
				this.renderOp.indexData.indexCount = 0;

				// lock index buffer ready to receive data
#if !AXIOM_SAFE_ONLY
				unsafe
#endif
				{
					var pIdx = this.renderOp.indexData.indexBuffer.Lock( BufferLocking.Discard );
					var sizeOfElement = this.renderOp.indexData.indexBuffer.Type == IndexType.Size32
					                    	? sizeof ( uint )
					                    	: sizeof ( ushort );

					for ( int i = 0; i < faceGrp.Count; i++ )
					{
						// Cache each
						int numElems = CacheGeometry( pIdx, faceGrp[ i ] );
						this.renderOp.indexData.indexCount += numElems;
						pIdx += numElems*sizeOfElement;
					}

					// Unlock the buffer
					this.renderOp.indexData.indexBuffer.Unlock();
				}

				// Skip if no faces to process (we're not doing flare types yet)
				if ( this.renderOp.indexData.indexCount == 0 )
				{
					continue;
				}

				if ( isQuakeShader )
				{
					for ( int i = 0; i < thisMaterial.GetTechnique( 0 ).PassCount; i++ )
					{
						SetPass( thisMaterial.GetTechnique( 0 ).GetPass( i ) );
						targetRenderSystem.Render( this.renderOp );
					}
					passIsSet = false;
				}
				else if ( !passIsSet )
				{
					int i;
					for ( i = 0; i < thisMaterial.GetTechnique( 0 ).PassCount; i++ )
					{
						SetPass( thisMaterial.GetTechnique( 0 ).GetPass( i ) );

						// for ambient lighting
						if ( i == 0 && this.level.BspOptions.ambientEnabled )
						{
							targetRenderSystem.SetTextureBlendMode( 0, ambientBlend );
						}

						targetRenderSystem.Render( this.renderOp );
					}

					// if it's only 1 pass then there's no need to set it again
					passIsSet = ( i > 1 ) ? false : true;
				}
				else
				{
					Pass pass = thisMaterial.GetTechnique( 0 ).GetPass( 0 );
					// Get the plain geometry texture
					if ( pass.TextureUnitStatesCount > 0 )
					{
						TextureUnitState geometryTex = pass.GetTextureUnitState( 0 );
						targetRenderSystem.SetTexture( 0, true, geometryTex.TextureName );
					}

					if ( pass.TextureUnitStatesCount > 1 )
					{
						// Get the lightmap
						TextureUnitState lightmapTex = pass.GetTextureUnitState( 1 );
						targetRenderSystem.SetTexture( 1, true, lightmapTex.TextureName );
					}

					targetRenderSystem.Render( this.renderOp );
				}
			}

			//if(showNodeAABs)
			//	targetRenderSystem.Render(aaBGeometry);
		}
 /// <summary>
 ///
 /// </summary>
 /// <param name="position"></param>
 /// <param name="owner"></param>
 /// <param name="color"></param>
 public Billboard(Vector3 position, BillboardSet owner, ColorEx color)
 {
     this.Color     = color;
     this.Position  = position;
     this.ParentSet = owner;
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="position"></param>
 /// <param name="owner"></param>
 public Billboard(Vector3 position, BillboardSet owner)
 {
     this.Position  = position;
     this.ParentSet = owner;
     this.Color     = ColorEx.White;
 }
Example #47
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="color"></param>
 /// <returns></returns>
 public static string ToString(ColorEx color)
 {
     return(string.Format(englishCulture, "{0} {1} {2} {3}", color.r, color.g, color.b, color.a));
 }
Example #48
0
 public override void SetValue(ColorEx val)
 {
     light.Specular = val;
 }
Example #49
0
            public override void ApplyDeltaValue(ColorEx val)
            {
                ColorEx c = light.Specular;

                SetValue(new ColorEx(c.a + val.a, c.r + val.r, c.g + val.g, c.b + val.b));
            }
Example #50
0
 public override void SetValue(ColorEx val)
 {
     light.Diffuse = val;
 }
Example #51
0
            public override void ApplyDeltaValue(ColorEx val)
            {
                ColorEx c = light.Diffuse;

                SetValue(new ColorEx(c.a * val.a, c.r + val.r, c.g + val.g, c.b + val.b));
            }
Example #52
0
		public CompositionPass( CompositionTargetPass parent )
		{
			this.parent = parent;
			type = CompositorPassType.RenderQuad;
			identifier = 0;
			firstRenderQueue = RenderQueueGroupID.Background;
			lastRenderQueue = RenderQueueGroupID.SkiesLate;
			materialSchemeName = string.Empty;
			clearBuffers = FrameBufferType.Color | FrameBufferType.Depth;
			clearColor = new ColorEx( 0f, 0f, 0f, 0f );
			clearDepth = 1.0f;
			clearStencil = 0;
			stencilCheck = false;
			stencilFunc = CompareFunction.AlwaysPass;
			stencilRefValue = 0;
			stencilMask = 0x7FFFFFFF;
			stencilFailOp = StencilOperation.Keep;
			stencilDepthFailOp = StencilOperation.Keep;
			stencilPassOp = StencilOperation.Keep;
			stencilTwoSidedOperation = false;
			quadCornerModified = false;
			quadLeft = -1;
			quadTop = 1;
			quadRight = 1;
			quadBottom = -1;
			quadFarCorners = false;
			quadFarCornersViewSpace = false;
		}
        /// <summary>
        ///		Asks the current API to convert an instance of ColorEx to a 4 byte packed
        ///		uint value the way it would expect it.
        /// </summary>
        /// <param name="color"></param>
        /// <returns></returns>
        public uint ConvertColor(ColorEx color)
        {
            Debug.Assert(activeRenderSystem != null, "Cannot covert color value without an active renderer.");

            return(activeRenderSystem.ConvertColor(color));
        }
Example #54
0
 /// <summary>
 ///		Enables / disables fading the trail using color.
 /// </summary>
 /// <param name="chainIndex"> The index of the chain</param>
 /// <param name="valuePerSecond"> The amount to subtract from color each second</param>
 public virtual void SetColorChange(int chainIndex, ColorEx valuePerSecond)
 {
     trailAttributes[chainIndex].deltaColor = (ColorEx)valuePerSecond.Clone();
 }
Example #55
0
 /// <summary>
 ///		Set the starting ribbon color for a given segment.
 /// </summary>
 /// <param name="chainIndex"> The index of the chain</param>
 /// <param name="color"> The initial color</param>
 public virtual void SetInitialColor(int chainIndex, ColorEx col)
 {
     trailAttributes[chainIndex].initialColor = (ColorEx)col.Clone();
 }