当前位置: 首页>>代码示例>>C#>>正文


C# AABB.Expand方法代码示例

本文整理汇总了C#中AABB.Expand方法的典型用法代码示例。如果您正苦于以下问题:C# AABB.Expand方法的具体用法?C# AABB.Expand怎么用?C# AABB.Expand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AABB的用法示例。


在下文中一共展示了AABB.Expand方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OpenFrame

        public void OpenFrame(FrameDescription frame)
        {
            this.config.Merge(frame);
            this.OutputSettings = new OutputSettingsInfo(frame);
            this.QualitySettings = new QualitySettingsInfo(frame);

            this.FrameName = frame.FrameName;
            width = frame.Get<int>("ImageWidth");
            height = frame.Get<int>("ImageHeight");
            if (!string.IsNullOrWhiteSpace(frame.WorkingDir))
                Directory.SetCurrentDirectory(frame.WorkingDir);
   
            if (Scene == null) {
                var svc = new SceneGraphService();
                svc.Populate(new GlobalIndexObjLoader(), new MaterialLoader());

                var builder = new SceneBuilder() { SGService = svc };
                builder.Setup();
                this.Scene = builder.OpenFrame(frame, AreaLightAsMeshLight);
                this.Scene.DefaultLightGain = config.Get("LightGain", new RgbSpectrum(1.0f));
                this.Scene.MaxPathDepth = config.Get("MaxPathDepth", 15);
                this.Scene.RussianRuletteImportanceCap = config.Get("RRImportanceCap", 0.75f);
                this.Scene.MaxPaths = config.Get("PathBufferSize", 65536 >> 10);
                this.Scene.ShadowRayCount = config.Get("ShadowRayCount", 16);
                this.Scene.TextureSamplingQuality = this.QualitySettings.TextureSamplingQuality;
                this.Scene.AreaLightAsMesh = this.AreaLightAsMeshLight;
                this.Scene.MatLib = new OptimizedBsdfLibrary();

                this.Scene.MatLib.Populate(builder.MaterialInfos.ToArray());

                (this.Scene.MatLib as OptimizedBsdfLibrary) .Replace("Object_MaterialView_Test", this.ObjectMaterial);
                (this.Scene.MatLib as OptimizedBsdfLibrary).Replace("Plane_Material", this.PlaneMaterial);

                foreach (var brdf in ObjectMaterial.Where(brdf => brdf != null))
                {
                    builder.ProcessMaterial(0, brdf.MaterialData);
                }
                foreach (var brdf in PlaneMaterial.Where(brdf => brdf != null))
                {
                    builder.ProcessMaterial(1, brdf.MaterialData);
                }

                RenderThreadsCount = config.Get("RenderThreadsCount",1);
                this.scene = builder.SceneGeo;

                var sceneBound = new AABB(scene.BoundingSphereCenter - scene.BoundingSphereRadius,
                                          scene.BoundingSphereCenter + scene.BoundingSphereRadius);
                sceneBound.Expand(1f);

                //var viewBound = new AABB(Scene.Camera.Target - 5f, Scene.Camera.Target + 5f);
                Scene.VolumeIntegrator = new SingleScatteringIntegrator(sceneBound, sceneBound.Size.Length / 10f, 0.15f, RgbSpectrum.UnitSpectrum()*0.095f, new RgbSpectrum(0.0005f));
            }
         

            this.Initialize();

        }
开发者ID:HungryBear,项目名称:rayden,代码行数:57,代码来源:MaterialViewRayEngineConfiguration.cs

示例2: OpenFrame

        public void OpenFrame(Library.Entity.Frames.FrameDescription frame)
        {
            this.CurrentFrame = new FrameConfiguration();

            this.config.Merge(frame);
            this.OutputSettings = new OutputSettingsInfo(frame);
            this.QualitySettings = new QualitySettingsInfo(frame);

            this.FrameName = frame.FrameName;

            if (!string.IsNullOrWhiteSpace(frame.WorkingDir))
                Directory.SetCurrentDirectory(frame.WorkingDir);
            /*
            foreach (var frameElement in frame.Elements.Where(frameElement => frameParsers.ContainsKey(frameElement.GetType()))) {
                frameParsers[frameElement.GetType()](frameElement);
            }*/

            if (Scene == null)
            {
                SceneGraphService svc = new SceneGraphService();
                svc.Populate(
                    //new ObjLoader(),
                    new GlobalIndexObjLoader(),
                    new MaterialLoader());

                //svc.OpenFrame(frame);
                _builder = new SceneBuilder() { SGService = svc };
                _builder.Setup();
                this.SceneGraph = _builder.SGService.SceneGraph;
                this.Scene = _builder.OpenFrame(frame, this.AreaLightAsMeshLight);

                this.Scene.DefaultLightGain = config.Get("LightGain", new RgbSpectrum(1.0f));
                this.Scene.MaxPathDepth = config.Get("MaxPathDepth", 10);
                this.Scene.RussianRuletteImportanceCap = config.Get("RRImportanceCap", 0.75f);
                this.Scene.MaxPaths = config.Get("PathBufferSize", 65536);
                this.Scene.ShadowRayCount = config.Get("ShadowRayCount", 1);
                this.Scene.TextureSamplingQuality = this.QualitySettings.TextureSamplingQuality;
                this.Scene.LightSamplingStrategy = this.QualitySettings.LightSamplingStrategy;
                RgbSpectrum.Gamma = true;
                /*
                if (GlobalConfiguration.Instance.SpectralRendering)
                {
                    this.Scene.SpectralMats = new BxDFLibrary(new LambertianBrdf(new[] { 0.5f, 0.5f, 0.5f }));
                    this.Scene.SpectralMats.Populate(_builder.MaterialInfos.ToArray());
                }
                else*/

                {
                    this.Scene.MatLib = this.dependencyManager.GetMaterialPlugin(_builder.MaterialInfos.ToArray());
                    if (_builder.FrameMaterialBuilder != null)
                    {
                        this.Scene.MatLib.Add(_builder.FrameMaterialBuilder.Materials);
                        _builder.FrameMaterialBuilder.CreateRayEngineMaterials(this.Scene);
                    }
                    //if (EnableMaterialOverrides) FrameMaterialBuilder.ApplyMaterialOverrides((this.Scene.MatLib as OptimizedBsdfLibrary).Materials, Scene);
                }


                RenderThreadsCount = config.Get("RenderThreadsCount", 1);
                this.scene = _builder.SceneGeo;

                var sceneBound = new AABB(scene.BoundingSphereCenter - scene.BoundingSphereRadius,
                                          scene.BoundingSphereCenter + scene.BoundingSphereRadius);
                sceneBound.Expand(1f);

                //var viewBound = new AABB(Scene.Camera.Target - 5f, Scene.Camera.Target + 5f);
                var c = new Point(Scene.Camera.Target);
                var bb = new AABB(c - 1f, c + 1f);
                var volumeBound = sceneBound;

                Scene.VolumeIntegrator = new SingleScatteringIntegrator(volumeBound,
                                                                         volumeBound.Size.Length / 10f, //step
                                                                         0.05f, //Probability
                                                                         RgbSpectrum.UnitSpectrum() * 0.05f,  //Inscatering
                                                                         new RgbSpectrum(0.000f)             //Emission

                                                                       );
                new RayEngineMaterialBuilder().BuildMaterials(this.Scene);
            }
            this.CurrentFrame.Width = frame.Get<int>("ImageWidth");
            this.CurrentFrame.Height = frame.Get<int>("ImageHeight");
            this.CurrentFrame.ImageSavePath = this.SavePath;
            this.CurrentFrame.LowLatency = lowLatency;
            this.CurrentFrame.MaxSamplesPerPixel = this.QualitySettings.SamplesPerPixel;

            this.Initialize();
            this.Scene.BuildPrimitives();
        }
开发者ID:HungryBear,项目名称:rayden,代码行数:88,代码来源:CorrectorEngineConfiguration.cs

示例3: LoadFrameDescription

        public void LoadFrameDescription(FrameDescription frame)
        {
            this.Configuration.Merge(frame);
            this.OutputSettings = new OutputSettingsInfo(frame);
            this.QualitySettings = new QualitySettingsInfo(frame);

            this.FrameName = frame.FrameName;
            var width = frame.Get<int>("ImageWidth");
            var height = frame.Get<int>("ImageHeight");

            Directory.SetCurrentDirectory(frame.WorkingDir);
            /*
            foreach (var frameElement in frame.Elements.Where(frameElement => frameParsers.ContainsKey(frameElement.GetType()))) {
                frameParsers[frameElement.GetType()](frameElement);
            }*/

            if (Scene == null)
            {
                SceneGraphService svc = new SceneGraphService();
                svc.Populate(new GlobalIndexObjLoader(), new MaterialLoader());

                //svc.OpenFrame(frame);
                _builder = new SceneBuilder() { SGService = svc };
                _builder.Setup();
                this.Scene = _builder.OpenFrame(frame, AreaLightAsMeshLight);
                this.Scene.DefaultLightGain = Configuration.Get("LightGain", new RgbSpectrum(1.0f));
                this.Scene.MaxPathDepth = Configuration.Get("MaxPathDepth", 5);
                this.Scene.RussianRuletteImportanceCap = Configuration.Get("RRImportanceCap", 0.75f);
                this.Scene.MaxPaths = Configuration.Get("PathBufferSize", 65536 >> 10);
                this.Scene.ShadowRayCount = Configuration.Get("ShadowRayCount", 1);
                this.Scene.TextureSamplingQuality = this.QualitySettings.TextureSamplingQuality;
                this.Scene.LightSamplingStrategy = LightSamplingStrategy.UniformOneLight;

                var scene = _builder.SceneGeo;

                var sceneBound = new AABB(scene.BoundingSphereCenter - scene.BoundingSphereRadius,
                                          scene.BoundingSphereCenter + scene.BoundingSphereRadius);
                sceneBound.Expand(1f);

                //var viewBound = new AABB(Scene.Camera.Target - 5f, Scene.Camera.Target + 5f);
                var c = new Point(Scene.Camera.Target);
                var bb = new AABB(c - 1f, c + 1f);
                var volumeBound = sceneBound;
                Scene.VolumeIntegrator = new SingleScatteringIntegrator(volumeBound,
                                                                         volumeBound.Size.Length / 10f, //step
                                                                         0.005f, //Probability
                                                                         RgbSpectrum.UnitSpectrum() * 0.095f,  //Inscatering
                                                                         new RgbSpectrum(0.00005f)             //Emission
                                                                       );
            }

            this.Context = new EngineContext() { RenderThreads = Configuration.Get("RenderThreadsCount", 1), FrameConfiguration = frame, Scene = this.Scene };
            this.Initialize();
        }
开发者ID:HungryBear,项目名称:rayden,代码行数:54,代码来源:EngineManager.cs

示例4: OpenSceneConfiguration

        public void OpenSceneConfiguration(string configPath)
        {
            Scene = new RayEngineScene();
            this.Scene.DefaultLightGain = config.Get("LightGain", new RgbSpectrum(1.75f));
            this.Scene.MaxPathDepth = config.Get("MaxPathDepth", 10);
            this.Scene.RussianRuletteImportanceCap = config.Get("RRImportanceCap", 0.75f);
            this.Scene.MaxPaths = config.Get("PathBufferSize", 65536 >> 1);
            this.Scene.ShadowRayCount = config.Get("ShadowRayCount", 1);

            var loader = new SceneConfigurationLoader();
            loader.Load(configPath, Scene);
            this.width = ValueReader.Convert<int>(loader.Config.ReadFrame("width").ToString());
            this.height = ValueReader.Convert<int>(loader.Config.ReadFrame("height").ToString());
            this.AreaLightAsMeshLight = Scene.AreaLightAsMesh;

            this.Scene.MatLib = this.dependencyManager.GetMaterialPlugin(loader.MaterialInfos);
            if (loader.Materials.Any())
            {
                this.Scene.MatLib.Merge(loader.Materials.ToArray());
            }

            RenderThreadsCount = config.Get("RenderThreadsCount", 1);
            this.scene = loader.SceneGeo;

            var sceneBound = new AABB(scene.BoundingSphereCenter - scene.BoundingSphereRadius,
                                        scene.BoundingSphereCenter + scene.BoundingSphereRadius);
            sceneBound.Expand(1f);

            var volumeBound = sceneBound;
            this.FrameName = loader.Config.ReadFrame("name").ToString();

            Scene.VolumeIntegrator = new SingleScatteringIntegrator(volumeBound,
                                                                        volumeBound.Size.Length / 10f, //step
                                                                        0.05f, //Probability
                                                                        RgbSpectrum.UnitSpectrum() * 0.05f,  //Inscatering
                                                                        new RgbSpectrum(0.0005f)             //Emission

                                                                    );
            foreach (var triangleMeshInfo in Scene.sceneData.Meshes)
            {
                triangleMeshInfo.MaterialID = ((MaterialInfoContainer)Scene.MaterialProvider).GetMaterialID(triangleMeshInfo.MaterialName);
            }

            this.QualitySettings = loader.qualitySettings;
            this.OutputSettings = loader.outputSettings;
            this.Initialize();
        }
开发者ID:HungryBear,项目名称:rayden,代码行数:47,代码来源:RayEngineConfiguration.cs


注:本文中的AABB.Expand方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。