예제 #1
0
        public void init()
        {
            sunLight = new LightSun(new Vector3(0.1f, 0.125f, 0.2f) * 3f, this);
            sunLight.lightAmbient = new Vector3(0.1f, 0.125f, 0.2f) * 0.5f;//new Vector3(0.2f, 0.125f, 0.1f);//new Vector3(0.1f, 0.14f, 0.3f);
            sunLight.PointingDirection = Vector3.Normalize(new Vector3(674, -674, 1024));
            sunFrameBuffer = gameWindow.framebufferCreator.createFrameBuffer("shadowFramebuffer", shadowRes * 2, shadowRes * 2, PixelInternalFormat.Rgba8, false);
            sunInnerFrameBuffer = gameWindow.framebufferCreator.createFrameBuffer("shadowFramebuffer", shadowRes * 2, shadowRes * 2, PixelInternalFormat.Rgba8, false);

            mFilter2d = new Quad2d(this);

            mSkyModel = new Skybox(this, gameWindow);

            mGroundPlane = new GroundPlane(this);
            mGroundPlane.setMaterial("floor.xmf");

            mGroundPlane.setMesh("water_plane.obj");
            mGroundPlane.setMaterial("floor.xmf");

            //need to be fixed -- cant be executed after voxel Manager creation.

            if(Settings.Instance.video.Particles)
                generateParticleSys();

            voxelManager = new VoxelManager(this);

            compositeMod.X = Settings.Instance.video.gamma;

            particleAffectors.Add(new ParticleAffectorWind(new Vector3(1,-0.5f,0) * 0.01f));
            particleAffectors.Add(new ParticleAffectorFriction(0.1f));
            particleAffectors.Add(new ParticleAffectorFloorKiller(waterLevel));
            particleAffectors.Add(new ParticleAffectorLifeTimeKiller(this));

            /*
                waterModel.setTextures(mTextureLoader.fromMixed(new int[]{
                TextureGroup.TYPE_FRAMEBUFFER,
                TextureGroup.TYPE_FROMFILE},
                new string[] {
                    Convert.ToString(waterFramebuffer.ColorTexture),
                    "noise.png"}));
             */

            mGroundPlane.Position = new Vector3(0,waterLevel,0);
            //mGroundPlane.updateModelMatrix();

            Matrix4 translate = Matrix4.CreateTranslation(0, -waterLevel * 2, 0);
            Matrix4 invert = Matrix4.Scale(1, -1, 1);
            Matrix4.Mult(ref translate, ref invert, out mWaterMatrix);
        }
예제 #2
0
        /*
        public Model
            BloomViewboard,
            BloomViewboard2,
            CompositeViewboard,
            AoViewboard,
            AoBlrViewboard;
         */
        public Scene(OpenTkProjectWindow mGameWindow)
        {
            this.gameWindow = mGameWindow;
            Scene = this;

            sunLight = new LightSun(new Vector3(0.1f, 0.125f, 0.2f) * 3f, this);
            sunLight.lightAmbient = new Vector3(0.1f, 0.125f, 0.2f) * 0.5f;//new Vector3(0.2f, 0.125f, 0.1f);//new Vector3(0.1f, 0.14f, 0.3f);
            sunLight.PointingDirection = Vector3.Normalize(new Vector3(674, -674, 1024));
            sunFrameBuffer = gameWindow.framebufferCreator.createFrameBuffer("shadowFramebuffer", shadowRes * 2, shadowRes * 2, PixelInternalFormat.Rgba8, false);
            sunInnerFrameBuffer = gameWindow.framebufferCreator.createFrameBuffer("shadowFramebuffer", shadowRes * 2, shadowRes * 2, PixelInternalFormat.Rgba8, false);

            //sunLight.pointingDirection = Vector3.Normalize(new Vector3(674, 674, 1024));

            // creating a new collision system and adding it to the new world
            CollisionSystem collisionSystem = new CollisionSystemSAP();
            world = new World(collisionSystem);

            // Create the groundShape and the body.
            Shape groundShape = new BoxShape(new JVector(100, waterLevel * 2, 100));
            RigidBody groundBody = new RigidBody(groundShape);

            // make the body static, so it can't be moved
            groundBody.IsStatic = true;

            // add the ground to the world.
            world.AddBody(groundBody);
        }