예제 #1
0
파일: Rasterizer.cs 프로젝트: denniskb/asvo
            /// <summary>
            /// Renders the sparse voxel octree stored in <paramref name="obj"/>.
            /// 
            /// - Viewing frustum culling
            /// - Level of detail
            /// </summary>
            /// <param name="object3D">The object to be rendered.</param>
            /// <param name="fromPerspective">The camera this model shall be rendered from.</param>
            /// <param name="threadIndex">The index of the calling thread, starting by 0.</param>
            public void render(Object3D object3D, Camera fromPerspective, int threadIndex)
            {
                _depthBuffer.zeroOut(threadIndex);
                float dimension = -0.5f * object3D.getData().dimension;
                Vector3 octreeMin = new Vector3(dimension, dimension, dimension);

                traverse(object3D,
                         0,
                         0, 0, 0,
                         fromPerspective.getProjectionMatrix(),
                         object3D.getTransformation() *
                         fromPerspective.getViewMatrix(),
                         object3D.getTransformation() *
                         fromPerspective.getViewProjectionMatrix(),
                         0,
                         0.0f,
                         threadIndex,
                         octreeMin);
            }