Пример #1
0
        protected IObject DefaultBoxObj(String modelName, Vector3 position, Vector3?scale = null, float mass = 10, Matrix?orientation = null)
        {
            SimpleModel     simpleModel = new SimpleModel(GraphicFactory, modelName);
            BoxObject       tmesh       = new BoxObject(position, 1, 1, 1, mass, scale, orientation);
            ForwardMaterial fmaterial   = ForwardMaterial.DefaultForwardMaterial();

            return(new IObject(fmaterial, simpleModel, tmesh));
        }
Пример #2
0
        protected IObject DefaultSphereObj(String modelName, Vector3 position, float radius, float scale = 1, float mass = 10)
        {
            SimpleModel     simpleModel = new SimpleModel(GraphicFactory, modelName);
            SphereObject    tmesh       = new SphereObject(position, radius, mass, scale);
            ForwardMaterial fmaterial   = ForwardMaterial.DefaultForwardMaterial();

            return(new IObject(fmaterial, simpleModel, tmesh));
        }
Пример #3
0
        protected IObject DefaultTriangleMeshObj(String modelName, Vector3 position, Vector3?scale = null, Matrix?orientation = null)
        {
            SimpleModel        simpleModel = new SimpleModel(GraphicFactory, modelName);
            TriangleMeshObject tmesh       = new TriangleMeshObject(simpleModel, position, orientation, scale);
            ForwardMaterial    fmaterial   = ForwardMaterial.DefaultForwardMaterial();

            return(new IObject(fmaterial, simpleModel, tmesh));
        }
Пример #4
0
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            {
                SimpleModel        simpleModel = new SimpleModel(factory, "Model//cenario");
                TriangleMeshObject tmesh       = new TriangleMeshObject(simpleModel, Vector3.Zero);
                ForwardMaterial    fmaterial   = ForwardMaterial.DefaultForwardMaterial();
                IObject            obj         = new IObject(fmaterial, simpleModel, tmesh);
                obj.Name = "scene";
                this.World.AddObject(obj);
            }

            {
                SimpleModel        simpleModel = new SimpleModel(factory, "Model//uzi");
                TriangleMeshObject tmesh       = new TriangleMeshObject(simpleModel, new Vector3(100, 10, 10), Matrix.Identity, Vector3.One * 10);
                shader1 = new ForwardXNABasicShader();
                shader1.UseOcclusionCulling = true;
                ForwardMaterial fmaterial = new ForwardMaterial(shader1);
                IObject         obj       = new IObject(fmaterial, simpleModel, tmesh);
                obj.Name = "uzzi";
                this.World.AddObject(obj);
            }

            {
                SimpleModel simpleModel = new SimpleModel(factory, "Model//block");
                simpleModel.SetTexture(factory.CreateTexture2DColor(1, 1, Color.Green), TextureType.DIFFUSE);
                TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, new Vector3(100, 20, 200), Matrix.Identity, new Vector3(300, 300, 5));
                shader2 = new ForwardXNABasicShader();
                shader2.UseOcclusionCulling = true;
                ForwardMaterial fmaterial = new ForwardMaterial(shader2);
                IObject         obj       = new IObject(fmaterial, simpleModel, tmesh);
                obj.Name = "Block";
                this.World.AddObject(obj);
            }


            {
                SimpleModel simpleModel = new SimpleModel(factory, "Model//block");
                simpleModel.SetTexture(Color.Red);
                TriangleMeshObject    tmesh = new TriangleMeshObject(simpleModel, new Vector3(150, 20, 250), Matrix.Identity, new Vector3(300, 300, 5));
                ForwardXNABasicShader sh    = new ForwardXNABasicShader();
                sh.UseOcclusionCulling = false;
                ForwardMaterial fmaterial = new ForwardMaterial(sh);
                IObject         obj       = new IObject(fmaterial, simpleModel, tmesh);
                obj.Name = "Block";
                this.World.AddObject(obj);
            }
            for (int i = 0; i < 10; i++)
            {
                for (int j = 0; j < 10; j++)
                {
                    ///Cria modelo com textura procedural amarela
                    SimpleModel sm = new SimpleModel(factory, "Model\\block");
                    sm.SetTexture(Color.Yellow);
                    GhostObject pi = new GhostObject(new Vector3(i * 10, 50, j * 10), Matrix.Identity, new Vector3(5));
                    ForwardTransparenteShader s   = new ForwardTransparenteShader(0.3f);
                    ForwardMaterial           mat = new ForwardMaterial(s);
                    IObject obj4 = new IObject(mat, sm, pi);
                    this.World.AddObject(obj4);
                }
            }


            this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo));
        }