Beispiel #1
0
        public static void ColorMaterialWithZone(MaterialPtr eMat, Zones z)
        {
            eMat.SetSceneBlending(SceneBlendType.SBT_TRANSPARENT_ALPHA);
            ColourValue c = CityManager.GetZoneColor(z);

            eMat.SetDiffuse(c.r, c.g, c.b, 0.5f);
            eMat.SetDepthWriteEnabled(false);
        }
Beispiel #2
0
        public static void ColorMaterialWithResource(MaterialPtr eMat, ResourceDict resources, ResourceType r)
        {
            ColourValue c   = CityManager.GetResourceColor(r);
            double      val = resources[r];

            val = Math.Log10(val) / 6.0;
            val = Math.Min(Math.Max(val, 0), 1);
            eMat.SetDiffuse(c.r, c.g, c.b, (float)val);
            eMat.SetSceneBlending(SceneBlendType.SBT_TRANSPARENT_ALPHA);
            eMat.SetDepthWriteEnabled(false);
        }
Beispiel #3
0
        public override void Create(SceneManager sm, SceneNode baseNode)
        {
            foreach (Entity e in GetBuildingEntities(sm, out this.scale, out this.baseRotation, out this.color))
            {
                this.entities.Add(e);

                MaterialPtr mat = e.GetSubEntity(0).GetMaterial().Clone(e.Name + "_" + this.GetHashCode().ToString() + "_" + DateTime.Now.ToString());
                mat.SetDiffuse(this.color);
                e.GetSubEntity(0).SetMaterial(mat);
            }
            base.Create(sm, baseNode);


            if (Data.Parent != null)
            {
                this.SetPosition(Data.Parent.X, Data.Parent.Y);
            }
            if (Data is Road)
            {
                node.Translate(0, 2, 0);
            }
        }
Beispiel #4
0
        public static SceneNode DrawLine(SceneManager mSceneMgr, Vector3 start, Vector3 end)
        {
            ManualObject line     = mSceneMgr.CreateManualObject("line" + numLines);
            SceneNode    lineNode = mSceneMgr.RootSceneNode.CreateChildSceneNode("line" + numLines + "_node");

            MaterialPtr lineMaterial = MaterialManager.Singleton.Create("line" + numLines + "_material", "Default");

            lineMaterial.ReceiveShadows = false;
            lineMaterial.SetLightingEnabled(true);
            lineMaterial.SetDiffuse(LineColour.r, LineColour.g, LineColour.b, 0);
            lineMaterial.SetAmbient(LineColour.r, LineColour.g, LineColour.b);
            lineMaterial.SetSelfIllumination(LineColour.r, LineColour.g, LineColour.b);

            line.Begin("line" + numLines + "_material", RenderOperation.OperationTypes.OT_LINE_LIST);
            line.Position(start);
            line.Position(end);
            line.End();

            lineNode.AttachObject(line);
            ++numLines;
            return(lineNode);
        }