Beispiel #1
0
        protected override void OnLoad()
        {
            base.OnLoad();

            model = Vox.Load("Content/Models/chr_knight.vox");
            PointCloudRenderer.Point[] points = new PointCloudRenderer.Point[model.Voxels.Length];
            for (int i = 0; i < model.Voxels.Length; i++)
            {
                var v = model.Voxels[i];
                var c = model.Palette[v.C];

                points[i] = new PointCloudRenderer.Point
                {
                    // In MagicaVoxel z is up.
                    Position = new Vector3(-v.X, v.Z, v.Y),
                    Colour   = new Color4(c.R, c.G, c.B, c.A)
                };
            }

            pcr = new PointCloudRenderer(points);

            rtr = new RayTracedRenderer(model);

            CursorGrabbed = true;
            VSync         = VSyncMode.On;
            //WindowState = WindowState.Maximized;

            UpdateCamera();
            UpdateProjectionMatrix();

            GL.Enable(EnableCap.DepthTest);
            GL.Enable(EnableCap.Multisample);
            GL.Enable(EnableCap.CullFace);

            GL.Enable(EnableCap.Blend);
            GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);
        }
Beispiel #2
0
        public RayTracedRenderer(Vox model)
        {
            CreateCubeGeometry();

            shader = Shader.Load("Voxel Ray Tracer", "Content/Shaders/VoxelRayTracer.vs", "Content/Shaders/VoxelRayTracer.fs");
        }