Пример #1
0
 public EthalonRenderer()
 {
     stats = new RenderStats();
 }
Пример #2
0
        public BaseRenderer()
        {
            CpuThreadsUsed = 8;
            stats = new RenderStats();
            lights = new List<ILight>();
            rnd = new ThreadLocal<FastRandom>(() => new FastRandom(((int)(DateTime.UtcNow.Ticks >> 16))));
            //frameParsers = new Dictionary<Type, Action<IFrameElement>> {
            //    { typeof (FrameCamera), 
            //        item => {
            //                    var cameraItem =(FrameCamera) item;
            //                    camera = this.CreateCamera(width, height, cameraItem);
                                   
            //        }},
            //    { typeof (FrameObjFileReference), 
            //        item => {
            //                    var objFileRef = (FrameObjFileReference)item;
            //                    var loader = new GlobalIndexObjLoader();
            //                    scene = loader.Load(objFileRef.ObjFilePath);
            //                    var mload = new MaterialLoader();
            //                    mats = mload.LoadMaterials(objFileRef.MtlFilePath);
            //                    foreach (
            //                        var materialInfo in mats) {
                                                                                                              
            //                            if (materialInfo.Name.ToLower().Contains("glass") ||
            //                                materialInfo.Name.ToLower().Contains("wire_134006006") 
            //                                ) {
            //                                    materialInfo.Kt = materialInfo.Kd;
            //                                    materialInfo.Kd = RgbSpectrum.ZeroSpectrum();

            //                                    materialInfo.MediumInfo = Glass;
            //                                }
            //                            if (materialInfo.Name.ToLower().Contains("metal")) {
            //                                materialInfo.Kr = materialInfo.Kd;
            //                            }
            //                        }
            //        }},


            //    { typeof(Frame3DsFileReference), item =>
            //        {
            //            var sceneFileRef = (Frame3DsFileReference)item;
            //            var loader = new SceneLoader();
            //            scene = loader.Load(sceneFileRef.FilePath);
            //            mats = loader.LoadMaterials(sceneFileRef.FilePath);

            //            foreach (var materialInfo in mats) {
            //                if (materialInfo.Name.ToLower().Contains("glass") ||
            //                    materialInfo.Name.ToLower().Contains("wire_134006006")
            //                    ) {
            //                        materialInfo.Kt = materialInfo.Kd;
            //                        materialInfo.Kd = RgbSpectrum.ZeroSpectrum();

            //                        materialInfo.MediumInfo = Glass;
            //                    }
            //                if (materialInfo.Name.ToLower().Contains("metal")) {
            //                    materialInfo.Kr = materialInfo.Kd;
            //                }
            //            }
            //            if (scene.Cameras != null && scene.Cameras.Any()) {
            //                camera = new PinholeCamera(width, height) {Fov  = scene.Cameras[0].Fov };
            //                camera.LookAt((Point) scene.Cameras[0].Position, (Point) scene.Cameras[0].Direction, -scene.Cameras[0].Up);
            //            }
            //        }},

            //    { typeof (FrameLightsource), 
            //        item => {
            //                    var lightsource = (FrameLightsource)item;
            //                    switch (lightsource.LightType) {
            //                        case LightSourceTypes.Point:
            //                            lights.Add(new PointLight(lightsource));
            //                            break;
            //                        case LightSourceTypes.EnvironmentMap:
            //                            lights.Add(EnvironmentMap = new InfiniteLight(lightsource));
            //                            break;
            //                        case LightSourceTypes.Area:
            //                            if (areaLights == null) {
            //                                areaLights = new List<AreaLightInfo>();
            //                            }
            //                            areaLights.Add(
            //                                new AreaLightInfo() {
            //                                    Gain = lightsource.Parameters.Get<RgbSpectrum>(FrameLightsource.LightsourcePower),
            //                                    GeoName = lightsource.Parameters.Get<string>(FrameLightsource.AreaLightGeometryName)
            //                                }
            //                                );
            //                            break;
            //                    }
            //        }}
            //};
        }