示例#1
0
        protected override void OnLoad(EventArgs e)
        {
            DefaultGraphicsBehaviourLoader.InitializeDefaultGraphicsBehaviour();
            camera = new Camera((GameWindow)this);

            manMesh = new UnlitMesh("../../TestGeometries/man.obj", "../../Textures/manTexture.png");

            previousState = Keyboard.GetState();

            base.OnLoad(e);
        }
示例#2
0
        protected override void OnLoad(EventArgs e)
        {
            DefaultGraphicsBehaviourLoader.InitializeDefaultGraphicsBehaviour();
            camera = new Camera((GameWindow)this);
            camera.Move(new Vector3(5f, 0f, 2f));

            lampGeometry = Geometry.CreateFromOBJ("../../TestGeometries/sphere.obj");
            lampShader   = new Shader("../../Shaders/Lit/Vertex.glsl", "../../Shaders/Lit/lampFragment.glsl");


            material = new Material("../../brickTexture.jpg", new Vector3(1.0f, 1.0f, 1.0f), 0.05f, 0.5f, 32f);
            meshes   = new Mesh[_cubePositions.Length];
            for (int i = 0; i < meshes.Length; i++)
            {
                meshes[i] = new Mesh(
                    _cubePositions[i],
                    new Vector3(1.0f, 0.3f, 0.5f) * 20f * i,
                    1f,
                    "../../TestGeometries/BoxPositionAndUV.obj",
                    material
                    );
            }

            lightHolder.Add(light);
            //lightHolder.Add(secondLight);

            pointLight0 = new PointLight(Vector3.One * 4, Vector3.UnitZ, 2f, 0.5f, 0.1f, 0.05f);
            pointLight1 = new PointLight(Vector3.One * -4, Vector3.UnitX, 2f, 0.5f, 0.1f, 0.05f);
            lightHolder.Add(pointLight0);
            lightHolder.Add(pointLight1);

            spotLight = new SpotLight(
                lightPosition,
                camera.frontDirection,
                Vector3.UnitY,
                60f,
                25f,
                2f
                );
            lightHolder.Add(spotLight);

            base.OnLoad(e);
        }
示例#3
0
        protected override void OnLoad(EventArgs e)
        {
            DefaultGraphicsBehaviourLoader.InitializeDefaultGraphicsBehaviour();
            GL.CullFace(CullFaceMode.FrontAndBack);
            //GL.Enable(GL.CullFace);
            camera = new Camera((GameWindow)this);
            camera.Move(new Vector3(0f, -13f, -32f));

            indicator = new UnlitMesh("../../TestGeometries/point.obj", "../../Textures/default.jpg");

            manMaterial = new Material(
                "../../Textures/manTexture.png", // texturePath
                Vector3.One,                     //Ambient color
                0.005f,                          //Ambient Intensity
                1f,                              //Specular strength
                4                                //Shininess
                );
            manMesh = new Mesh(
                new Vector3(0f, 0f, 0f),        //Position
                Vector3.Zero,                   //Rotation
                1f,                             //Scale
                "../../TestGeometries/Man.obj", //Geometry path
                manMaterial                     //material
                );

            woodMaterial = new Material(
                "../../Textures/WoodTexture.png", // texturePath
                Vector3.One,                      //Ambient color
                0.05f,                            //Ambient Intensity
                5f,                               //Specular strength
                10                                //Shininess
                );
            woodMesh = new Mesh(
                new Vector3(-3f, 0f, 3f),                //Position
                Vector3.Zero,                            //Rotation
                3f,                                      //Scale
                "../../TestGeometries/TestGeometry.obj", //Geometry path
                woodMaterial                             //material
                );

            groundMaterial = new Material(
                "../../Textures/pebbleTexture.jpg", // texturePath
                Vector3.One,                        //Ambient color
                0.05f,                              //Ambient Intensity
                5f,                                 //Specular strength
                10                                  //Shininess
                );
            groundMesh = new Mesh(
                new Vector3(0f, 0f, 3f),           //Position
                Vector3.Zero,                      //Rotation
                3f,                                //Scale
                "../../TestGeometries/Ground.obj", //Geometry path
                groundMaterial                     //material
                );

            sun = new DirectionalLight(
                new Vector3(0f, -1f, 0f), //Direction
                Vector3.One,              //Color
                1f                        //Intensity
                );
            //lightHolder.Add(sun);
            spotLight = new SpotLight(
                indicatorPosition,    //position
                -1 * Vector3.UnitY,   //direction
                Vector3.One,          //color
                600f,                 //intensity
                40f,
                0.1f,
                0.1f,
                0.1f,
                0.01f
                );
            lightHolder.Add(spotLight);

            previousState = Keyboard.GetState();

            base.OnLoad(e);
        }
示例#4
0
        protected override void OnLoad(EventArgs e)
        {
            DefaultGraphicsBehaviourLoader.InitializeDefaultGraphicsBehaviour();
            camera = new Camera((GameWindow)this);
            camera.Move(new Vector3(0f, 0f, 6f));

            lamp = new UnlitMesh("../../TestGeometries/point.obj", "../../Textures/default.jpg");

            unlitMesh = new UnlitMesh("../../TestGeometries/TestGeometry.obj", "../../Textures/WoodTexture.png");


            brickMaterial = new Material(
                "../../Textures/BrickTexture.png", // texturePath
                Vector3.One,                       //Ambient color
                0.05f,                             //Ambient Intensity
                1f,                                //Specular strength
                4                                  //Shininess
                );
            brickMesh = new Mesh(
                new Vector3(-3f, 0f, 0f),                //Position
                Vector3.Zero,                            //Rotation
                1f,                                      //Scale
                "../../TestGeometries/TestGeometry.obj", //Geometry path
                brickMaterial                            //material
                );

            woodMaterial = new Material(
                "../../Textures/WoodTexture.png", // texturePath
                Vector3.One,                      //Ambient color
                0.05f,                            //Ambient Intensity
                5f,                               //Specular strength
                10                                //Shininess
                );
            woodMesh = new Mesh(
                new Vector3(0f, 0f, 3f),                 //Position
                Vector3.Zero,                            //Rotation
                1f,                                      //Scale
                "../../TestGeometries/TestGeometry.obj", //Geometry path
                woodMaterial                             //material
                );

            metalMaterial = new Material(
                "../../Textures/MetalTexture.png", // texturePath
                Vector3.One,                       //Ambient color
                0.05f,                             //Ambient Intensity
                20f,                               //Specular strength
                20                                 //Shininess
                );
            metalMesh = new Mesh(
                new Vector3(3f, 0f, 0f),                 //Position
                Vector3.Zero,                            //Rotation
                1f,                                      //Scale
                "../../TestGeometries/TestGeometry.obj", //Geometry path
                metalMaterial                            //material
                );


            lightHolder = new LightHolder();

            whitePointLight = new PointLight(
                new Vector3(0f, 3f, 0f), //position
                new Vector3(1f, 1f, 1f), //color
                0.5f                     //intensity
                );
            lightHolder.Add(whitePointLight);

            sunLight = new DirectionalLight(
                new Vector3(1f, -1f, 1f), //Direction
                Vector3.One,              //Color
                0.5f                      //Intensity
                );
            lightHolder.Add(sunLight);

            base.OnLoad(e);
        }