Esempio n. 1
0
        internal QuadTree(Vector3 position, List<VertexPositionNormalTexture> positions, Texture2D heightMap, Matrix viewMatrix, Matrix projectionMatrix, GraphicsDevice device)
        {
            Device = device;
            _position = position;
            _topNodeSize = heightMap.Width - 1;

            _vertices = new TreeVertexCollection(positions);

            _buffers = new BufferManager(_vertices.Vertices, device);
            _rootNode = new QuadNode(NodeType.FullNode, _topNodeSize, 1, null, this, 0);

            //Initialize the bounding frustrum to be used for culling later.
            ViewFrustrum = new BoundingFrustum(viewMatrix * projectionMatrix);

            //Construct an array large enough to hold all of the indices we'll need
            Indices = new int[((heightMap.Width + 1) * (heightMap.Height + 1)) * 3];

            Cull = false;
        }
Esempio n. 2
0
        internal QuadTree(Vector3 position, List <VertexPositionNormalTexture> positions, Texture2D heightMap, Matrix viewMatrix, Matrix projectionMatrix, GraphicsDevice device)
        {
            Device       = device;
            _position    = position;
            _topNodeSize = heightMap.Width - 1;

            _vertices = new TreeVertexCollection(positions);

            _buffers  = new BufferManager(_vertices.Vertices, device);
            _rootNode = new QuadNode(NodeType.FullNode, _topNodeSize, 1, null, this, 0);

            //Initialize the bounding frustrum to be used for culling later.
            ViewFrustrum = new BoundingFrustum(viewMatrix * projectionMatrix);

            //Construct an array large enough to hold all of the indices we'll need
            Indices = new int[((heightMap.Width + 1) * (heightMap.Height + 1)) * 3];

            Cull = false;
        }