コード例 #1
0
ファイル: MapViewer.cs プロジェクト: BuloZB/serverZero
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            camera = new Camera();
            hud = new HUD();
            cursor = new GroundCursor();
            map = new Map();

            base.Initialize();
        }
コード例 #2
0
ファイル: MapPart.cs プロジェクト: BuloZB/serverZero
        public MapPart(Map parentMap, Vector3 position, int size, float scale)
        {
            this.parentMap = parentMap;
            this.position = position;
            this.size = size;
            this.scale = scale;

            this.terrainEffect = MapViewer.contentManager.Load<Effect>("Effects/Terrain");
            this.terrainEffect.CurrentTechnique = this.terrainEffect.Techniques[this.parentMap.CurrentTechnique];

            this.vertexList = new List<VertexTerrain>();
            this.vertDeclaration = new VertexDeclaration(MapViewer.graphics.GraphicsDevice, VertexTerrain.VertexElements);
            this.indexBuffers = new IndexBuffer[(int)LOD.NumOfLODs];
            this.numTris = new int[(int)LOD.NumOfLODs];

            terrainTextures = new Texture2D[4];
            terrainTextureNormals = new Texture2D[4];

            /*
            Vector3 min = new Vector3(position.X, 0f, position.Z);
            Vector3 max = new Vector3(position.X + (float)(size - 1), 0f, position.Z + (float)(size - 1));

            triangle = new Tri[2];
            triangle[0].id = 0;
            triangle[0].p1 = min;
            triangle[0].p2 = new Vector3(min.X, min.Y, max.Z);
            triangle[0].p3 = new Vector3(max.X, min.Y, min.Z);
            triangle[0].normal = MathExtra.GetNormal(triangle[0].p1, triangle[0].p2, triangle[0].p3);

            triangle[1].id = 1;
            triangle[1].p1 = new Vector3(max.X, min.Y, min.Z);
            triangle[1].p2 = new Vector3(min.X, min.Y, max.Z);
            triangle[1].p3 = max;
            triangle[1].normal = MathExtra.GetNormal(triangle[1].p1, triangle[1].p2, triangle[1].p3);
             */
        }