Example #1
0
        static void Main()
        {
            scene = (Scene)Activator.CreateInstance(Constants.SceneIndex);

            //Create the RayTracer setup you want to use here
            IRayTracer tracer = (IRayTracer)Activator.CreateInstance(Constants.RayTracer, scene);

            tracer.Render();
        }
Example #2
0
        public async Task Run(string inputFile, string outputFile)
        {
            var @object = new ObjParser(await File.ReadAllTextAsync(inputFile)).ToGroup().ToMesh();

            @object.Transform(Matrix.RotationX(MathF.PI / 2).Scale(5, 5, 5));

            var scene = _sceneProvider.GetScene();

            scene.Objects.Add(@object);

            var image = _rayTracer.Render(scene);
            var sr    = new StreamWriter($"{Path.GetFileNameWithoutExtension(outputFile)}.ppm");
            await image.ToPpmAsync(sr.BaseStream);
        }