示例#1
0
 public override void Update()
 {
     mesh.SetPosition(Position.X, Position.Y, Position.Z);
     Direction = GetDirection();
     Core.LightEngine.SetLightDirection(LightId, Direction.X, Direction.Y, Direction.Z);
     Core.LightEngine.SetLightColor(LightId, Color.R / 255f, this.Color.G / 255f, this.Color.B / 255f);
     Core.LightEngine.EnableLight(LightId, Visible);
 }
示例#2
0
 protected ObjectBase(ICore core)
 {
     Core       = core;
     Scale      = new VECTOR3D(1.0f, 1.0f, 1.0f);
     Selected   = false;
     Visible    = true;
     Renderable = true;
     core.AllObjects.Add(this);
     custom        = new CustomCollection();
     ScriptEnabled = core.Settings.ScriptEnabled;
     Script        = core.Settings.Script;
 }
示例#3
0
 protected ObjectBase(ICore core)
 {
     Core = core;
     Scale = new VECTOR3D(1.0f, 1.0f, 1.0f);
     Selected = false;
     Visible = true;
     Renderable = true;
     core.AllObjects.Add(this);
     custom = new CustomCollection();
     ScriptEnabled = core.Settings.ScriptEnabled;
     Script = core.Settings.Script;
 }
示例#4
0
        public PointLight(ICore core, TV_3DVECTOR position)
            : base(core)
        {
            Position   = new VECTOR3D(position.x, position.y, position.z);
            this.Color = new MyColor();
            mesh       = core.Scene.CreateMeshBuilder();
            mesh       = Core.Scene.CreateBillboard(Helpers.GetTextureFromResource(core, Resources.pointLight), position.x, position.y,
                                                    position.z, 1.0f, 1.0f);
            mesh.SetAlphaTest(true);

            UniqueId = mesh.GetMeshName();
            Radius   = 30f;
            LightId  = core.LightEngine.CreatePointLight(position, 1f, 1f, 1f, Radius);
            Core.LightEngine.SetLightProperties(LightId, true, true, true);
            Name = core.GetName <PointLight>();
        }
示例#5
0
文件: Sound.cs 项目: zulis/Sandbox
        public Sound(ICore core, string fileName)
            : base(core)
        {
            FileName = fileName;
            Name = core.GetName<Sound>();

            TV_3DVECTOR position = Core.Camera.GetFrontPosition(10.0f);
            Position = new VECTOR3D(position.x, position.y, position.z);
            Is3D = false;
            mySound = core.SoundFactory.Load(fileName, Is3D);
            core.SoundFactory.StopAllSounds();
            mesh = core.Scene.CreateBillboard(Helpers.GetTextureFromResource(core, Resources.sound), position.x, position.y,
                                              position.z, 1.0f, 1.0f);
            mesh.SetAlphaTest(true);
            Stopped = true;
            Loop = false;
            volume = 100;
            UniqueId = mesh.GetMeshName();
        }
示例#6
0
 public Sound(ICore core, string fileName)
     : base(core)
 {
     FileName = fileName;
     Name = core.GetName<Sound>();
     
     TV_3DVECTOR position = Core.Camera.GetFrontPosition(10.0f);
     Position = new VECTOR3D(position.x, position.y, position.z);
     Is3D = false;
     mySound = core.SoundFactory.Load(fileName, Is3D);
     core.SoundFactory.StopAllSounds();
     mesh = core.Scene.CreateBillboard(Helpers.GetTextureFromResource(core, Resources.sound), position.x, position.y,
                                       position.z, 1.0f, 1.0f);
     mesh.SetAlphaTest(true); 
     Stopped = true;
     Loop = false;
     volume = 100;
     UniqueId = mesh.GetMeshName();
 }
示例#7
0
        public DirectionalLight(ICore core, TV_3DVECTOR position)
            : base(core)
        {
            LightId    = -1;
            Position   = new VECTOR3D(position.x, position.y, position.z);
            Direction  = GetDirection();
            this.Color = new MyColor();
            mesh       = core.Scene.CreateMeshBuilder();
            mesh       = Core.Scene.CreateBillboard(Helpers.GetTextureFromResource(core, Resources.directionalLight), position.x, position.y,
                                                    position.z, 1.0f, 1.0f);
            mesh.SetAlphaTest(true);
            UniqueId = mesh.GetMeshName();

            LightId = core.LightEngine.CreateDirectionalLight(new TV_3DVECTOR(Direction.X, Direction.Y, Direction.Z), Color.R / 255f, this.Color.G / 255f, this.Color.B / 255f, Helpers.SUN);
            //core.LightEngine.SetLightAttenuation(LightId, 1f, 0f, 0f);
            //core.LightEngine.SetSpecularLighting(true);
            //core.LightEngine.EnableLight(LightId, true);
            Core.LightEngine.SetLightProperties(LightId, true, true, true);
            Name = "DirectionalLight";
        }
示例#8
0
        public DirectionalLight(ICore core, TV_3DVECTOR position)
            : base(core)
        {
            LightId = -1;
            Position = new VECTOR3D(position.x, position.y, position.z);
            Direction = GetDirection();
            this.Color = new MyColor();
            mesh = core.Scene.CreateMeshBuilder();
            mesh = Core.Scene.CreateBillboard(Helpers.GetTextureFromResource(core, Resources.directionalLight), position.x, position.y,
                                             position.z, 1.0f, 1.0f);
            mesh.SetAlphaTest(true);
            UniqueId = mesh.GetMeshName();

            LightId = core.LightEngine.CreateDirectionalLight(new TV_3DVECTOR(Direction.X, Direction.Y, Direction.Z), Color.R / 255f, this.Color.G / 255f, this.Color.B / 255f, Helpers.SUN);
            //core.LightEngine.SetLightAttenuation(LightId, 1f, 0f, 0f);
            //core.LightEngine.SetSpecularLighting(true);
            //core.LightEngine.EnableLight(LightId, true);
            Core.LightEngine.SetLightProperties(LightId, true, true, true);
            Name = "DirectionalLight";
        }
示例#9
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            var    sValue = value as string;
            object retVal = null;

            if (sValue != null)
            {
                sValue = sValue.Trim();

                if (sValue.Length != 0)
                {
                    if (null == culture)
                    {
                        culture = CultureInfo.CurrentCulture;
                    }

                    string[] parms = sValue.Split(new char[] { culture.TextInfo.ListSeparator[0] });

                    if (parms.Length == 1)
                    {
                        float x = float.Parse(parms[0]);
                        retVal = new VECTOR3D(x, x, x);
                    }
                    else if (parms.Length == 3)
                    {
                        float x = float.Parse(parms[0]);
                        float y = float.Parse(parms[1]);
                        float z = float.Parse(parms[2]);

                        retVal = new VECTOR3D(x, y, z);
                    }
                }
            }
            else
            {
                retVal = ConvertFrom(context, culture, value);
            }

            return(retVal);
        }
示例#10
0
        public SkySphere(ICore core)
            : base(core)
        {
            this.core = core;
            Texture = Helpers.GetTextureSourceFromResource(core, Resources.defaultTexture);
            core.Atmosphere.SkySphere_Enable(true);
            core.Atmosphere.SkyBox_Enable(false);
            core.Atmosphere.SkySphere_SetScale(1, 1, 1);
            Name = "SkySphere";
            UniqueId = Name;
            Core.IsSkySphere = true;
            Renderable = false;

            float scaleX = 0, scaleY = 0, scaleZ = 0;
            core.Atmosphere.SkySphere_GetScale(ref scaleX, ref scaleY, ref scaleZ);
            Scale = new VECTOR3D(scaleX, scaleY, scaleZ);

            TV_3DVECTOR rotation = core.Atmosphere.SkySphere_GetRotation();
            Rotation = new VECTOR3D(rotation.x, rotation.y, rotation.z);

            PolyCount = core.Atmosphere.SkySphere_GetPolyCount();
        }
示例#11
0
文件: Particle.cs 项目: zulis/Sandbox
        //[Browsable(false)]
        //public override VECTOR3D Rotation { get; set; }
        public Particle(ICore core, string fileName)
            : base(core)
        {
            this.core = core;
            FileName = fileName;
            Visible = true;
            Name = core.GetName<Particle>();

            TV_3DVECTOR position = Core.Camera.GetFrontPosition(10.0f);
            Position = new VECTOR3D(position.x, position.y, position.z);
            mesh = core.Scene.CreateBillboard(Helpers.GetTextureFromResource(core, Resources.particleBig), position.x, position.y,
                                              position.z, 1.0f, 1.0f);
            mesh.SetAlphaTest(true);

            particle = core.Scene.CreateParticleSystem();
            particle.Load(fileName);
            particle.SetGlobalPosition(Position.X, Position.Y, Position.Z);
            particle.SetGlobalRotation(Rotation.X, Rotation.Y, Rotation.Z);
            particle.SetGlobalScale(Scale.X, Scale.Y, Scale.Z);

            UniqueId = mesh.GetMeshName();
        }
示例#12
0
        //[Browsable(false)]
        //public override VECTOR3D Rotation { get; set; }

        public Particle(ICore core, string fileName)
            : base(core)
        {
            this.core = core;
            FileName  = fileName;
            Visible   = true;
            Name      = core.GetName <Particle>();

            TV_3DVECTOR position = Core.Camera.GetFrontPosition(10.0f);

            Position = new VECTOR3D(position.x, position.y, position.z);
            mesh     = core.Scene.CreateBillboard(Helpers.GetTextureFromResource(core, Resources.particleBig), position.x, position.y,
                                                  position.z, 1.0f, 1.0f);
            mesh.SetAlphaTest(true);

            particle = core.Scene.CreateParticleSystem();
            particle.Load(fileName);
            particle.SetGlobalPosition(Position.X, Position.Y, Position.Z);
            particle.SetGlobalRotation(Rotation.X, Rotation.Y, Rotation.Z);
            particle.SetGlobalScale(Scale.X, Scale.Y, Scale.Z);

            UniqueId = mesh.GetMeshName();
        }
示例#13
0
        public SkySphere(ICore core)
            : base(core)
        {
            this.core = core;
            Texture   = Helpers.GetTextureSourceFromResource(core, Resources.defaultTexture);
            core.Atmosphere.SkySphere_Enable(true);
            core.Atmosphere.SkyBox_Enable(false);
            core.Atmosphere.SkySphere_SetScale(1, 1, 1);
            Name             = "SkySphere";
            UniqueId         = Name;
            Core.IsSkySphere = true;
            Renderable       = false;

            float scaleX = 0, scaleY = 0, scaleZ = 0;

            core.Atmosphere.SkySphere_GetScale(ref scaleX, ref scaleY, ref scaleZ);
            Scale = new VECTOR3D(scaleX, scaleY, scaleZ);

            TV_3DVECTOR rotation = core.Atmosphere.SkySphere_GetRotation();

            Rotation = new VECTOR3D(rotation.x, rotation.y, rotation.z);

            PolyCount = core.Atmosphere.SkySphere_GetPolyCount();
        }
示例#14
0
文件: VECTOR3D.cs 项目: zulis/Sandbox
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            var sValue = value as string;
            object retVal = null;

            if (sValue != null)
            {
                sValue = sValue.Trim();

                if (sValue.Length != 0)
                {
                    if (null == culture)
                        culture = CultureInfo.CurrentCulture;

                    string[] parms = sValue.Split(new char[] {culture.TextInfo.ListSeparator[0]});

                    if (parms.Length == 1)
                    {
                        float x = float.Parse(parms[0]);
                        retVal = new VECTOR3D(x, x, x);
                    }
                    else if (parms.Length == 3)
                    {
                        float x = float.Parse(parms[0]);
                        float y = float.Parse(parms[1]);
                        float z = float.Parse(parms[2]);

                        retVal = new VECTOR3D(x, y, z);
                    }
                }
            }
            else
                retVal = ConvertFrom(context, culture, value);

            return retVal;
        }