Ejemplo n.º 1
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>();
        }
Ejemplo n.º 2
0
        public Trigger(ICore core)
            : base(core)
        {
            this.core = core;
            Name      = core.GetName <Trigger>();
            Color     = new MyColor(0, 255, 0);

            mesh = core.Scene.CreateMeshBuilder();
            mesh.CreateBox(1f, 1f, 1f, false);
            mesh.SetColor(core.Globals.RGBA(Color.R / 255f, Color.G / 255f, Color.B / 255f, 1));
            mesh.SetLightingMode(CONST_TV_LIGHTINGMODE.TV_LIGHTING_MANAGED);
            mesh.SetAlphaTest(true);
            mesh.SetBlendingMode(CONST_TV_BLENDINGMODE.TV_BLEND_ADD);

            UniqueId = mesh.GetMeshName();
        }
Ejemplo n.º 3
0
        public Trigger(ICore core)
            : base(core)
        {
            this.core = core;
            Name = core.GetName<Trigger>();
            Color = new MyColor(0, 255, 0);

            mesh = core.Scene.CreateMeshBuilder();
            mesh.CreateBox(1f, 1f, 1f, false);
            mesh.SetColor(core.Globals.RGBA(Color.R / 255f, Color.G / 255f, Color.B / 255f, 1));
            mesh.SetLightingMode(CONST_TV_LIGHTINGMODE.TV_LIGHTING_MANAGED);
            mesh.SetAlphaTest(true);
            mesh.SetBlendingMode(CONST_TV_BLENDINGMODE.TV_BLEND_ADD);

            UniqueId = mesh.GetMeshName();
        }
Ejemplo n.º 4
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();
        }
Ejemplo n.º 5
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();
 }
Ejemplo n.º 6
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";
        }
Ejemplo n.º 7
0
        public Water(ICore core)
            : base(core)
        {
            this.core = core;

            ReflectRS = core.Scene.CreateRenderSurfaceEx(-1, -1, CONST_TV_RENDERSURFACEFORMAT.TV_TEXTUREFORMAT_DEFAULT, true, true, 1);
            ReflectRS.SetBackgroundColor(core.Globals.RGBA(0f, 0f, 0.1906f, 1f));

            RefractRS = core.Scene.CreateRenderSurfaceEx(-1, -1, CONST_TV_RENDERSURFACEFORMAT.TV_TEXTUREFORMAT_DEFAULT, true, true, 1);
            RefractRS.SetBackgroundColor(core.Globals.RGBA(0f, 0f, 0.1906f, 1f));

            mesh = core.Scene.CreateMeshBuilder();
            mesh.AddFloor(Helpers.GetDUDVTextureFromResource(core, Resources.water), -256, -256, 256, 256, -3, 2, 2);

            plane = new TV_PLANE(core.Globals.Vector3(0, 1, 0), 3f);
            core.GraphicEffect.SetWaterReflection(mesh, ReflectRS, RefractRS, 0, plane);

            Name     = core.GetName <Water>();
            UniqueId = mesh.GetMeshName();
        }
Ejemplo n.º 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";
        }
Ejemplo n.º 9
0
        public Water(ICore core)
            : base(core)
        {
            this.core = core;

            ReflectRS = core.Scene.CreateRenderSurfaceEx(-1, -1, CONST_TV_RENDERSURFACEFORMAT.TV_TEXTUREFORMAT_DEFAULT, true, true, 1);
            ReflectRS.SetBackgroundColor(core.Globals.RGBA(0f, 0f, 0.1906f, 1f));

            RefractRS = core.Scene.CreateRenderSurfaceEx(-1, -1, CONST_TV_RENDERSURFACEFORMAT.TV_TEXTUREFORMAT_DEFAULT, true, true, 1);
            RefractRS.SetBackgroundColor(core.Globals.RGBA(0f, 0f, 0.1906f, 1f));

            mesh = core.Scene.CreateMeshBuilder();
            mesh.AddFloor(Helpers.GetDUDVTextureFromResource(core, Resources.water), -256, -256, 256, 256, -3, 2, 2);

            plane = new TV_PLANE(core.Globals.Vector3(0, 1, 0), 3f);
            core.GraphicEffect.SetWaterReflection(mesh, ReflectRS, RefractRS, 0, plane);

            Name = core.GetName<Water>();
            UniqueId = mesh.GetMeshName();
        }
Ejemplo n.º 10
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();
        }
Ejemplo n.º 11
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();
        }
Ejemplo n.º 12
0
        public Mesh(ICore core, ProgramSettings settings, string fileName)
            : base(core)
        {
            this.core     = core;
            this.settings = settings;

            mass            = 0f;
            staticFriction  = 0.9f;
            kineticFriction = 0.5f;
            softness        = 0.1f;
            bounciness      = 0.1f;
            materialIdx     = -1;
            SetMaterialToCustom();

            FileName      = fileName;
            customTexture = string.Empty;
            //Name = fileName.Split(new[] { '\\' }).Last();
            PhysicsId = -1;

            enableLightning = true;

            Name = core.GetName <Mesh>();
            string ending = fileName.Split(new[] { '\\' }).Last().ToUpper();

            mesh = core.Scene.CreateMeshBuilder();

            if (ending.EndsWith(Helpers.GetFileExtension(Helpers.FileFormat.TVM)))
            {
                mesh.LoadTVM(fileName, true, false);
            }
            else if (ending.EndsWith(Helpers.GetFileExtension(Helpers.FileFormat.X)))
            {
                mesh.LoadXFile(fileName, true, false);
            }
            else if (ending.EndsWith(Helpers.GetFileExtension(Helpers.FileFormat.TVA)))
            {
                TVActor actor = core.Scene.CreateActor();
                actor.Load(fileName, true, false);
                mesh = actor.GetDeformedMesh();
                core.Scene.DestroyAllActors();
                IsAnimated = true;
            }
            else
            {
                return;
            }

            mesh.EnableFrustumCulling(true, true);
            mesh.ComputeNormals();
            mesh.ComputeBoundings();
            mesh.ComputeOctree();
            mesh.SetCullMode(CONST_TV_CULLING.TV_BACK_CULL);
            mesh.SetBlendingMode(CONST_TV_BLENDINGMODE.TV_BLEND_ALPHA);
            mesh.SetAlphaTest(true);
            mesh.SetLightingMode(CONST_TV_LIGHTINGMODE.TV_LIGHTING_MANAGED);
            mesh.SetShadowCast(true, true);
            lightmapIdx = mesh.GetTextureEx((int)CONST_TV_LAYER.TV_LAYER_LIGHTMAP);

            textureScale = new UV(1.0f, 1.0f);

            LoadTextures();

            UniqueId = mesh.GetMeshName();
        }