Beispiel #1
0
        public Skybox(Scene mScene, OpenTkProjectWindow mGameWindow)
            : base(mScene)
        {
            Parent = mScene;
            this.Scene = mScene;
            mScene.drawables.Add(this);

            //setProgram("skybox/sky.fs");
            //mSkyModel.setMesh(mMeshLoader.loadObj("skybox/sky_1.obj"));
            //mSkyModel.setTextures(mTextureLoader.LoadTextures(new string[] { "skybox/sky_0001.png" }));

            for (int i = 0; i < 5; i++)
            {
                int sidetex = mGameWindow.textureLoader.getTexture("skybox\\sky_000" + (i + 1) + ".png");

                addMaterial("skybox\\sky" + (i + 1) + ".xmf");
                addMesh("skybox\\sky_" + (i + 1) + ".obj");
                //envTextures[i] = sidetex;
                //addTextures(new string[] { "skybox\\sky_000" + (i + 1) + ".png" });
            }

            float skyScale = mGameWindow.player.zFar / (float)Math.Sqrt(3);

            Size = new Vector3(skyScale, skyScale, skyScale);
            //updateModelMatrix();
        }
Beispiel #2
0
        public void Initialize(OpenTkProjectWindow window)
        {
            cacheAmount   = Performance.Instance.SampleCount * 8;           // this is totally random amount
            points        = new Vector3[cacheAmount];
            updateIndices = new int[cacheAmount];
            renderIndices = new int[cacheAmount];

            GL.GenBuffers(1, out positionVBO);
            GL.GenBuffers(1, out updateIndexVBO);
            GL.GenBuffers(1, out renderIndexVBO);

            Size     = window.screenSize;
            Position = new Vector2(0, 0);
            step     = Size.X / (float)Performance.Instance.SampleCount;

            win          = window;
            shd          = win.shaderLoader.getShader("perf.xsp");
            perfColorPos = GL.GetUniformLocation(shd.handle, "in_perfcolor");
            inposPos     = GL.GetAttribLocation(shd.handle, "in_position");
            projPos      = GL.GetUniformLocation(shd.handle, "projection_matrix");

            /// create VAO for Update graph
            GL.GenVertexArrays(1, out vaoUpdate);
            GL.BindVertexArray(vaoUpdate);

            GL.BindBuffer(BufferTarget.ArrayBuffer, positionVBO);
            GL.VertexAttribPointer(inposPos, 3, VertexAttribPointerType.Float, true, Vector3.SizeInBytes, 0);
            GL.EnableVertexAttribArray(inposPos);
            GL.BindBuffer(BufferTarget.ElementArrayBuffer, updateIndexVBO);


            /// create VAO for Render graph
            GL.GenVertexArrays(1, out vaoRender);
            GL.BindVertexArray(vaoRender);

            GL.BindBuffer(BufferTarget.ArrayBuffer, positionVBO);
            GL.VertexAttribPointer(inposPos, 3, VertexAttribPointerType.Float, true, Vector3.SizeInBytes, 0);
            GL.EnableVertexAttribArray(inposPos);
            GL.BindBuffer(BufferTarget.ElementArrayBuffer, renderIndexVBO);

            GL.BindVertexArray(0);

            CheckError();

            ProjMatrix = Matrix4.CreateOrthographicOffCenter(0, win.screenSize.X, win.screenSize.Y, 0, 0, 1);
        }
Beispiel #3
0
        public Skybox(Scene mScene, OpenTkProjectWindow mGameWindow) : base(mScene)
        {
            Parent     = mScene;
            this.Scene = mScene;
            mScene.drawables.Add(this);

            //setProgram("skybox/sky.fs");
            //mSkyModel.setMesh(mMeshLoader.loadObj("skybox/sky_1.obj"));
            //mSkyModel.setTextures(mTextureLoader.LoadTextures(new string[] { "skybox/sky_0001.png" }));

            for (int i = 0; i < 5; i++)
            {
                addMaterial("skybox\\sky" + (i + 1) + ".xmf");
                addMesh("skybox\\sky_" + (i + 1) + ".obj");
                //envTextures[i] = sidetex;
                //addTextures(new string[] { "skybox\\sky_000" + (i + 1) + ".png" });
            }

            float skyScale = mGameWindow.player.viewInfo.zFar / (float)Math.Sqrt(3);

            Size = new Vector3(skyScale, skyScale, skyScale);
            //updateModelMatrix();
        }
Beispiel #4
0
 public Model(OpenTkProjectWindow mGameWindow)
 {
     this.gameWindow = mGameWindow;
 }
Beispiel #5
0
 public Quad2d(OpenTkProjectWindow mGameWindow)
 {
     this.gameWindow = mGameWindow;
     setMaterial("composite.xmf");
     setMesh("sprite_plane.obj");
 }
Beispiel #6
0
        public void Initialize(OpenTkProjectWindow window)
        {
            cacheAmount = Performance.Instance.SampleCount * 8; // this is totally random amount
            points = new Vector3[ cacheAmount ];
            updateIndices = new int[cacheAmount];
            renderIndices = new int[cacheAmount];

            GL.GenBuffers(1, out positionVBO);
            GL.GenBuffers(1, out updateIndexVBO);
            GL.GenBuffers(1, out renderIndexVBO);

            Size = window.screenSize;
            Position = new Vector2(0, 0);
            step = Size.X / (float)Performance.Instance.SampleCount;

            win = window;
            shd = win.shaderLoader.getShader("perf.xsp");
            perfColorPos = GL.GetUniformLocation(shd.handle, "in_perfcolor");
            inposPos = GL.GetAttribLocation(shd.handle, "in_position");
            projPos = GL.GetUniformLocation(shd.handle, "projection_matrix");

            /// create VAO for Update graph
            GL.GenVertexArrays(1, out vaoUpdate);
            GL.BindVertexArray(vaoUpdate);

            GL.BindBuffer(BufferTarget.ArrayBuffer, positionVBO);
            GL.VertexAttribPointer(inposPos, 3, VertexAttribPointerType.Float, true, Vector3.SizeInBytes, 0);
            GL.EnableVertexAttribArray(inposPos);
            GL.BindBuffer(BufferTarget.ElementArrayBuffer, updateIndexVBO);

            /// create VAO for Render graph
            GL.GenVertexArrays(1, out vaoRender);
            GL.BindVertexArray(vaoRender);

            GL.BindBuffer(BufferTarget.ArrayBuffer, positionVBO);
            GL.VertexAttribPointer(inposPos, 3, VertexAttribPointerType.Float, true, Vector3.SizeInBytes, 0);
            GL.EnableVertexAttribArray(inposPos);
            GL.BindBuffer(BufferTarget.ElementArrayBuffer, renderIndexVBO);

            GL.BindVertexArray(0);

            CheckError();

            ProjMatrix = Matrix4.CreateOrthographicOffCenter(0, win.screenSize.X, win.screenSize.Y, 0, 0, 1);
        }
Beispiel #7
0
 public Model(OpenTkProjectWindow mGameWindow)
 {
     this.gameWindow = mGameWindow;
     renderlayer = RenderLayer.Solid;
 }
Beispiel #8
0
 public Quad2d(OpenTkProjectWindow mGameWindow)
 {
     this.gameWindow = mGameWindow;
     setMaterial("composite.xmf");
     setMesh("sprite_plane.obj");
 }
Beispiel #9
0
 public Model(OpenTkProjectWindow mGameWindow)
 {
     this.gameWindow = mGameWindow;
     renderlayer     = RenderLayer.Solid;
 }