示例#1
0
 public override void render(Game game, World world, Camera camera, Vector3 position, int meta)
 {
     if(life > 2){
         world.prepareModelMatrix(camera, position, camera.rotation.Y+angle);
         FrameManager.shot1.render(game);
     }
 }
示例#2
0
        public override void addRenderable(ref List<Object3<Vector3, Renderable, int>> renderList, Camera camera)
        {
            renderList.Add(new Object3<Vector3, Renderable, int>(position, this, 0));

            if (swingVisable) {
                Vector3 s = new Vector3(
                 position.X + (float)(Math.Sin(MathCustom.r180 - swingAngle - camera.rotation.Y) * swingDistance),
                 position.Y,
                 position.Z + (float)(Math.Cos(MathCustom.r180 - swingAngle - camera.rotation.Y) * swingDistance));

                renderList.Add(new Object3<Vector3, Renderable, int>(s, this, 1));
            }
        }
示例#3
0
 public override void render(Game game, World world, Camera camera, Vector3 position, int meta)
 {
     world.prepareModelMatrix(camera, position);
     FrameManager.playerDefault.render(game);
 }
示例#4
0
        internal void render(Game game, Camera camera)
        {
            GL.UseProgram(game.glProgram);
            GL.UniformMatrix4(game.modelMatrixLocation, 1, false, game.Matrix4ToArray(camera.getModelMatrix()));
            GL.UniformMatrix4(game.perspectiveMatrixLocation, 1, false, game.Matrix4ToArray(game.perspectiveMatrix));

            GL.BindTexture(TextureTarget.Texture2D, game.texturesId);

            if (camera.rotation.Y > MathCustom.r180 && camera.rotation.Y < MathCustom.r360) renderGroupXLow.render(game);

            if (camera.rotation.Y > 0 && camera.rotation.Y < MathCustom.r180) renderGroupXHigh.render(game);

            if (camera.rotation.Y > MathCustom.r90 && camera.rotation.Y < MathCustom.r270) renderGroupZLow.render(game);

            if ((camera.rotation.Y > MathCustom.r270 && camera.rotation.Y < MathCustom.r360) || (camera.rotation.Y > 0 && camera.rotation.Y < MathCustom.r90)) renderGroupZHigh.render(game);

            renderGroupTop.render(game);
            renderGroupFloor.render(game);

            Wall w;
            //Vector3 v;

            renderList.Clear();

            foreach (Entity e in entityList.Values) {
                if ((e.position + camera.position).LengthSquared < entityRenderDistanceSquared) {
                    e.addRenderable(ref renderList, camera);
                    //e.render(game, this, camera);
                }
            }

            int xMin = Math.Max((int)((-camera.position.X) - blockRenderDistance), 0);
            int yMin = Math.Max((int)((-camera.position.Z) - blockRenderDistance), 0);

            int xMax = Math.Min((int)((-camera.position.X) + blockRenderDistance), width);
            int yMax = Math.Min((int)((-camera.position.Z) + blockRenderDistance), height);

            foreach (Point v in flatRenderList) {
                w = Wall.getWall(wallGrid[v.X, v.Y]);
                if (w.hasFlag(WallFlag.flat)) {
                    renderList.Add(new Object3<Vector3, Renderable, int>(new Vector3(v.X, 0, v.Y), w, 0));
                    /*v = new Vector3(i, 0, j);
                    GL.UniformMatrix4(mm, 1, false, game.Matrix4ToArray(camera.getFlatMatrix(v)));
                    w.render(game, this, camera);*/
                }
            }

            float l = camera.rotation.Y - MathCustom.r180;

            Vector3 c = -camera.position + new Vector3(
                (float)(-Math.Sin(l) * 100),
                MathCustom.sin45Times100,
                (float)(Math.Cos(l) * 100));

            renderList.Sort(
                delegate(
                Object3<Vector3, Renderable, int> first,
                Object3<Vector3, Renderable, int> second) {
                    return
                        (first.x - c).LengthSquared.CompareTo(
                        (second.x - c).LengthSquared);
                }
            );

            //Console.WriteLine();

            foreach (Object3<Vector3, Renderable, int> element in renderList) {
                //GL.UniformMatrix4(mm, 1, false, game.Matrix4ToArray(camera.getFlatMatrix(element.Key)));
                //Console.WriteLine((element.Key - c).LengthSquared+": "+element.Value.GetType().Name);
                element.y.render(game, this, camera, element.x, element.z);
            }
        }
示例#5
0
 internal void prepareModelMatrix(Camera camera, Vector3 position, float angle = 0)
 {
     GL.UniformMatrix4(game.modelMatrixLocation, 1, false, game.Matrix4ToArray(camera.getFlatMatrix(position, angle)));
 }
示例#6
0
 public override void render(Game game, World world, Camera camera, Vector3 position, int meta)
 {
     if (meta == 0) {
         world.prepareModelMatrix(camera, position);
         FrameManager.playerDefault.render(game);
     }
     if (meta == 1 && swingVisable) {
         world.prepareModelMatrix(camera, position, -swingAngle);
         FrameManager.swing1.render(game);
     }
 }
示例#7
0
 public void render(Game game, World world, Camera camera, Vector3 position, int meta)
 {
     world.prepareModelMatrix(camera, position);
     renderGroup.render(game);
 }