Inheritance: BaseCamera
コード例 #1
0
        protected override void InitializeInner() {
            Camera = new CameraOrbit(45) {
                Alpha = 30.0f,
                Beta = 25.0f,
                NearZ = 0.1f,
                Radius = 5.5f,
                Target = Vector3.Zero
            };

            Scene.Add(_box1 = new RenderableList {
                new TestingCube()
            });

            _box2s = new RenderableList(null, Matrix.RotationX(90.5f) * Matrix.Translation(0.0f, 0.0f, 3.0f)) {new TestingCube()};
            Scene.Add(_box2 = new RenderableList {
                new TestingCube(),
                _box2s
            });
            
            Scene.Add(_box3 = new RenderableList {
                new TestingCube()
            });

            Scene.Add(_box4 = new RenderableList {
                new TestingCube()
            });
        }
コード例 #2
0
ファイル: Kn5ObjectRenderer.cs プロジェクト: gro-ove/actools
        protected override void InitializeInner() {
            base.InitializeInner();

            _materialsProvider = new MaterialsProviderDeferred();
            _texturesProvider = new TexturesProvider();
            DeviceContextHolder.Set(_materialsProvider);
            DeviceContextHolder.Set(_texturesProvider);
            
            Scene.Add(SkyObject.Create(500f));

            IRenderableObject mainNode = null;
            foreach (var kn5 in _kn5) {
                if (mainNode == null) {
                    _carHelper.SetKn5(DeviceContextHolder);
                } else {
                    _materialsProvider.SetKn5(kn5);
                    _texturesProvider.SetKn5(kn5.OriginalFilename, kn5);
                }

                var node = Kn5Converter.Convert(kn5.RootNode, DeviceContextHolder);
                Scene.Add(node);

                if (mainNode != null) continue;
                node.IsReflectable = false;
                mainNode = node;
            }

            var asList = mainNode as Kn5RenderableList;
            if (asList != null) {
                Scene.AddRange(_carHelper.LoadAmbientShadows(asList, 0.001f));

                _carHelper.AdjustPosition(asList);
                _carHelper.LoadMirrors(asList, DeviceContextHolder);
                LoadLights(asList);
            }

            Scene.UpdateBoundingBox();

            Camera = new CameraOrbit(32) {
                Alpha = 0.9f,
                Beta = 0.1f,
                NearZ = 0.2f,
                FarZ = 500f,
                Radius = mainNode?.BoundingBox?.GetSize().Length() * 1.2f ?? 4.8f,
                Target = (mainNode?.BoundingBox?.GetCenter() ?? Vector3.Zero) - new Vector3(0f, 0.05f, 0f)
            };

            _resetCamera = (CameraOrbit)Camera.Clone();

            Sun = new DirectionalLight {
                Color = FixLight(new Vector3(1.2f, 1.0f, 0.9f)) * 5f,
                Direction = Vector3.Normalize(new Vector3(-1.2f, -3.4f, -2.2f))
            };

            _effect = DeviceContextHolder.GetEffect<EffectDeferredGObject>();
        }