當前位置: 首頁>>代碼示例>>C#>>正文


C# Camera.BuildView方法代碼示例

本文整理匯總了C#中Camera.BuildView方法的典型用法代碼示例。如果您正苦於以下問題:C# Camera.BuildView方法的具體用法?C# Camera.BuildView怎麽用?C# Camera.BuildView使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Camera的用法示例。


在下文中一共展示了Camera.BuildView方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SetCamera

 protected void SetCamera(Camera cam)
 {
     Camera = cam;
     Camera.Aspect = (float)Width / (float)Height;
     Camera.Fov = Math.Max(cam.Fov, 65.0f);
     Camera.RotationVel = 100.0f;
     Camera.TranslationVel = 100.0f;
     cam.BuildView();
     CameraUpdate();
 }
開發者ID:HungryBear,項目名稱:Phantom,代碼行數:10,代碼來源:MainForm.cs

示例2: SetCamera

 protected void SetCamera(Camera cam)
 {
     Camera = cam;
     Camera.Aspect = (float)Width / (float)Height;
     Camera.Fov = StartingFov;
     Camera.RotationVel = 100.0f;
     Camera.TranslationVel = 100.0f;
     cam.BuildView();
     CameraUpdate();
 }
開發者ID:HungryBear,項目名稱:Phantom,代碼行數:10,代碼來源:MEForm.cs

示例3: Build

        public void Build(SceneGraph scene)
        {
            BuildCache = new Dictionary<string, object>(StringComparer.CurrentCultureIgnoreCase);
            var camera = scene.First<SceneCamera>();
            Guard.NotNull(camera, "Couldn't find camera in scene");

            var cameras = scene.OfType<SceneCamera>().ToArray();
            Cameras = new Camera[cameras.Length];
            for (int i = 0; i < cameras.Length; i++)
            {
                Cameras[i] = new Camera();
                Cameras[i].LookAt(cameras[i].Position, cameras[i].Direction, cameras[i].Up);
                Cameras[i].Fov = camera.Fov;
                Cameras[i].BuildView();
            }

            var sceneGeometryData = scene.First<SceneMeshData>();
            Guard.NotNull(sceneGeometryData, "Couldn't find sceneGeometryData in scene");
            var sceneGeometry = scene.Subset<SceneMeshEntity>().ToArray();
            Guard.NotNullOrEmpty(sceneGeometry, "No scene geometry present");
            var sceneMaterials = scene.Subset<SceneMaterial>().ToArray();
            Guard.NotNullOrEmpty(sceneMaterials, "No scene materials present");
            var sceneLights = scene.Subset<SceneLightsource>().ToArray();
            Guard.NotNullOrEmpty(sceneLights, "No scene lightsources present");
            var sceneResources = scene.Subset<SceneResourceReference>().ToArray();
            Camera = new Camera();
            Camera.LookAt(camera.Position, camera.Direction, camera.Up);
            Camera.Fov = camera.Fov;
            Camera.BuildView();

            Tracer.WriteLine("Start Building Materials");
            this.BuildMaterials(sceneMaterials, sceneResources);

            BuildCache.Add("Materials", sceneMaterials);

            Tracer.WriteLine("Start Building Geometry");
            var areaLights = sceneLights.Where(lt => lt.LightType == LightSourceTypes.Area).ToArray();

            if (areaLights.Any())
            {
                BuildCache.Add("AreaLights", areaLights.ToArray());
            }

            this.BuildGeometry(sceneGeometryData, sceneGeometry, areaLights.Any(), areaLights);
            this.BoundingSphereRadius = sceneGeometryData.BoundingSphereRadius;
            BuildCache.Add("Geometry", sceneGeometry);

            Tracer.WriteLine("Start Building Lightsources");
            this.BuildLights(sceneLights);

            Session.Frame.TopObject = this.topObject;
        }
開發者ID:HungryBear,項目名稱:Phantom,代碼行數:52,代碼來源:OptixSceneBuilder.cs


注:本文中的Camera.BuildView方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。