Example #1
0
        public ModelViewer(ITagContainer diContainer)
        {
            this.diContainer     = diContainer;
            device               = diContainer.GetTag <GraphicsDevice>();
            resourcePool         = diContainer.GetTag <IResourcePool>();
            textureLoader        = diContainer.GetTag <IAssetLoader <Texture> >();
            Window               = diContainer.GetTag <WindowContainer>().NewWindow("Model Viewer");
            Window.InitialBounds = new Rect(float.NaN, float.NaN, 1100.0f, 600.0f);
            Window.AddTag(this);
            editor = new TwoColumnEditorTag(Window, diContainer);
            var onceAction = new OnceAction();

            Window.AddTag(onceAction);
            Window.OnContent += onceAction.Invoke;
            var menuBar = new MenuBarWindowTag(Window);

            menuBar.AddButton("Open", HandleMenuOpen);
            fbArea            = Window.GetTag <FramebufferArea>();
            fbArea.OnResize  += HandleResize;
            fbArea.OnRender  += HandleRender;
            modelMaterialEdit = new ModelMaterialEdit(Window, diContainer);
            diContainer.GetTag <OpenDocumentSet>().AddEditor(this);

            openFileModal                    = new OpenFileModal(diContainer);
            openFileModal.Filter             = "*.dff";
            openFileModal.IsFilterChangeable = false;
            openFileModal.OnOpenedResource  += Load;
            imGuiRenderer                    = Window.Container.ImGuiRenderer;

            locationBuffer = new LocationBuffer(device);
            AddDisposable(locationBuffer);

            var localDiContainer = diContainer.ExtendedWith(locationBuffer);

            camera = new Camera(localDiContainer);
            AddDisposable(camera);

            controls = new OrbitControlsTag(Window, camera.Location, localDiContainer);
            AddDisposable(controls);

            gridRenderer = new DebugGridRenderer(diContainer);
            gridRenderer.Material.LinkTransformsTo(camera);
            gridRenderer.Material.World.Ref = Matrix4x4.Identity;
            AddDisposable(gridRenderer);

            triangleRenderer = new DebugTriangleLineRenderer(diContainer);
            triangleRenderer.Material.LinkTransformsTo(camera);
            triangleRenderer.Material.World.Ref = Matrix4x4.Identity;
            AddDisposable(triangleRenderer);

            planeRenderer = new DebugPlaneRenderer(diContainer);
            planeRenderer.Material.LinkTransformsTo(camera);
            planeRenderer.Material.World.Ref = Matrix4x4.Identity;
            AddDisposable(planeRenderer);

            editor.AddInfoSection("Statistics", HandleStatisticsContent);
            editor.AddInfoSection("Materials", HandleMaterialsContent);
            editor.AddInfoSection("Skeleton", HandleSkeletonContent);
            editor.AddInfoSection("Collision", HandleCollisionContent);
        }
Example #2
0
        public ActorEditor(ITagContainer diContainer)
        {
            this.diContainer     = diContainer;
            device               = diContainer.GetTag <GraphicsDevice>();
            resourcePool         = diContainer.GetTag <IResourcePool>();
            Window               = diContainer.GetTag <WindowContainer>().NewWindow("Actor Editor");
            Window.InitialBounds = new Rect(float.NaN, float.NaN, 1100.0f, 600.0f);
            Window.AddTag(this);
            editor = new TwoColumnEditorTag(Window, diContainer);
            var onceAction = new OnceAction();

            Window.AddTag(onceAction);
            Window.OnContent += onceAction.Invoke;
            var menuBar = new MenuBarWindowTag(Window);

            menuBar.AddButton("Open", HandleMenuOpen);
            fbArea           = Window.GetTag <FramebufferArea>();
            fbArea.OnResize += HandleResize;
            fbArea.OnRender += HandleRender;
            diContainer.GetTag <OpenDocumentSet>().AddEditor(this);

            openFileModal                    = new OpenFileModal(diContainer);
            openFileModal.Filter             = "*.aed";
            openFileModal.IsFilterChangeable = false;
            openFileModal.OnOpenedResource  += Load;

            locationBuffer = new LocationBuffer(device);
            AddDisposable(locationBuffer);
            localDiContainer = diContainer.ExtendedWith(locationBuffer);
            camera           = new Camera(localDiContainer);
            AddDisposable(camera);
            controls = new OrbitControlsTag(Window, camera.Location, localDiContainer);
            AddDisposable(controls);
            localDiContainer.AddTag(camera);

            gridRenderer = new DebugGridRenderer(diContainer);
            gridRenderer.Material.LinkTransformsTo(camera);
            gridRenderer.Material.World.Ref = Matrix4x4.Identity;
            AddDisposable(gridRenderer);
            localDiContainer.AddTag <IStandardTransformMaterial>(gridRenderer.Material);

            editor.AddInfoSection("Info", HandleInfoContent);
            editor.AddInfoSection("Animation Playback", HandlePlaybackContent);
            editor.AddInfoSection("Body animations", () => HandlePartContent(false, () => body?.AnimationsContent() ?? false), false);
            editor.AddInfoSection("Wings animations", () => HandlePartContent(true, () => wings?.AnimationsContent() ?? false), false);
            editor.AddInfoSection("Body skeleton", () => HandlePartContent(false, () => body?.skeletonRenderer.Content() ?? false), false);
            editor.AddInfoSection("Wings skeleton", () => HandlePartContent(true, () => wings?.skeletonRenderer.Content() ?? false), false);
            editor.AddInfoSection("Head IK", HandleHeadIKContent, false);
        }
Example #3
0
        public EffectEditor(ITagContainer diContainer)
        {
            device               = diContainer.GetTag <GraphicsDevice>();
            resourcePool         = diContainer.GetTag <IResourcePool>();
            gameTime             = diContainer.GetTag <GameTime>();
            Window               = diContainer.GetTag <WindowContainer>().NewWindow("Effect Editor");
            Window.InitialBounds = new Rect(float.NaN, float.NaN, 1100f, 600f);
            Window.AddTag(this);
            editor = new TwoColumnEditorTag(Window, diContainer);
            var onceAction = new OnceAction();

            Window.AddTag(onceAction);
            Window.OnContent += onceAction.Invoke;
            var menuBar = new MenuBarWindowTag(Window);

            menuBar.AddButton("Open", HandleMenuOpen);
            fbArea           = Window.GetTag <FramebufferArea>();
            fbArea.OnResize += HandleResize;
            fbArea.OnRender += HandleRender;
            diContainer.GetTag <OpenDocumentSet>().AddEditor(this);

            openFileModal = new OpenFileModal(diContainer)
            {
                Filter             = "*.ed",
                IsFilterChangeable = false
            };
            openFileModal.OnOpenedResource += Load;

            locationBuffer   = new LocationBuffer(device);
            this.diContainer = diContainer.ExtendedWith(locationBuffer);
            AddDisposable(this.diContainer);
            this.diContainer.AddTag(camera = new Camera(this.diContainer));
            this.diContainer.AddTag <IQuadMeshBuffer <EffectVertex> >(new DynamicQuadMeshBuffer <EffectVertex>(device.ResourceFactory, 1024));
            this.diContainer.AddTag <IQuadMeshBuffer <SparkVertex> >(new DynamicQuadMeshBuffer <SparkVertex>(device.ResourceFactory, 256));
            controls = new OrbitControlsTag(Window, camera.Location, this.diContainer);
            AddDisposable(controls);
            gridRenderer = new DebugGridRenderer(this.diContainer);
            gridRenderer.Material.LinkTransformsTo(camera);
            gridRenderer.Material.World.Ref = Matrix4x4.Identity;
            AddDisposable(gridRenderer);

            AddDisposable(textureLoader = new CachedAssetLoader <Texture>(new TextureAssetLoader(diContainer)));
            AddDisposable(clumpLoader   = new CachedClumpAssetLoader(diContainer));
            this.diContainer.AddTag <IAssetLoader <Texture> >(textureLoader);
            this.diContainer.AddTag <IAssetLoader <ClumpBuffers> >(clumpLoader);

            editor.AddInfoSection("Info", HandleInfoContent);
            editor.AddInfoSection("Playback", HandlePlaybackContent);
        }
Example #4
0
        public SceneEditor(ITagContainer diContainer)
        {
            this.diContainer = diContainer;
            resourcePool     = diContainer.GetTag <IResourcePool>();
            Window           = diContainer.GetTag <WindowContainer>().NewWindow("Scene Editor");
            Window.AddTag(this);
            Window.InitialBounds = new Rect(float.NaN, float.NaN, 1100.0f, 600.0f);
            editor = new TwoColumnEditorTag(Window, diContainer);
            var onceAction = new OnceAction();

            Window.AddTag(onceAction);
            Window.OnContent += onceAction.Invoke;
            locationBuffer    = new LocationBuffer(diContainer.GetTag <GraphicsDevice>());
            AddDisposable(locationBuffer);
            var menuBar = new MenuBarWindowTag(Window);

            menuBar.AddButton("Open", HandleMenuOpen);
            openFileModal                    = new OpenFileModal(diContainer);
            openFileModal.Filter             = "*.scn";
            openFileModal.IsFilterChangeable = false;
            openFileModal.OnOpenedResource  += Load;

            camera = new Camera(diContainer.ExtendedWith(locationBuffer));
            AddDisposable(camera);
            controls     = new FlyControlsTag(Window, camera.Location, diContainer);
            gridRenderer = new DebugGridRenderer(diContainer);
            gridRenderer.Material.LinkTransformsTo(camera);
            gridRenderer.Material.World.Ref = Matrix4x4.Identity;
            AddDisposable(gridRenderer);
            fbArea           = Window.GetTag <FramebufferArea>();
            fbArea.OnResize += HandleResize;
            fbArea.OnRender += camera.Update;
            fbArea.OnRender += locationBuffer.Update;
            fbArea.OnRender += gridRenderer.Render;

            localDiContainer = diContainer
                               .FallbackTo(Window)
                               .ExtendedWith(this, Window, gridRenderer, locationBuffer)
                               .AddTag <IAssetLoader <Texture> >(new CachedAssetLoader <Texture>(diContainer.GetTag <IAssetLoader <Texture> >()))
                               .AddTag <IAssetLoader <ClumpBuffers> >(new CachedClumpAssetLoader(diContainer))
                               .AddTag(camera);
            new DatasetComponent(localDiContainer);
            new WorldComponent(localDiContainer);
            new ModelComponent(localDiContainer);
            new FOModelComponent(localDiContainer);
            new TriggerComponent(localDiContainer);
            new SelectionComponent(localDiContainer);
        }
Example #5
0
        public WorldViewer(ITagContainer diContainer)
        {
            this.diContainer = diContainer;
            resourcePool     = diContainer.GetTag <IResourcePool>();
            Window           = diContainer.GetTag <WindowContainer>().NewWindow("World Viewer");
            Window.AddTag(this);
            Window.InitialBounds = new Rect(float.NaN, float.NaN, 1100.0f, 600.0f);
            editor = new TwoColumnEditorTag(Window, diContainer);
            var onceAction = new OnceAction();

            Window.AddTag(onceAction);
            Window.OnContent += onceAction.Invoke;
            Window.OnContent += UpdateIntersectionPrimitive;
            Window.OnKeyDown += HandleKeyDown;
            var menuBar = new MenuBarWindowTag(Window);

            menuBar.AddButton("Open", HandleMenuOpen);
            var gridRenderer = new DebugGridRenderer(diContainer);

            //gridRenderer.Material.LinkTransformsTo(controls.Projection, controls.View, controls.World);
            AddDisposable(gridRenderer);
            modelMaterialEdit = new ModelMaterialEdit(Window, diContainer);
            modelMaterialEdit.OpenEntriesByDefault = false;
            diContainer.GetTag <OpenDocumentSet>().AddEditor(this);
            openFileModal                    = new OpenFileModal(diContainer);
            openFileModal.Filter             = "*.bsp";
            openFileModal.IsFilterChangeable = false;
            openFileModal.OnOpenedResource  += Load;

            locationBuffer = new LocationBuffer(diContainer.GetTag <GraphicsDevice>());
            AddDisposable(locationBuffer);
            camera = new Camera(diContainer.ExtendedWith(locationBuffer));
            AddDisposable(camera);
            controls           = new FlyControlsTag(Window, camera.Location, diContainer);
            worldTransform     = new UniformBuffer <Matrix4x4>(diContainer.GetTag <GraphicsDevice>().ResourceFactory);
            worldTransform.Ref = Matrix4x4.Identity;
            AddDisposable(worldTransform);
            fbArea           = Window.GetTag <FramebufferArea>();
            fbArea.OnResize += HandleResize;
            fbArea.OnRender += locationBuffer.Update;
            fbArea.OnRender += worldTransform.Update;
            fbArea.OnRender += camera.Update;
            fbArea.OnRender += gridRenderer.Render;
            fbArea.OnRender += HandleRender;

            editor.AddInfoSection("Statistics", HandleStatisticsContent);
            editor.AddInfoSection("Materials", HandleMaterialsContent, false);
            editor.AddInfoSection("Sections", HandleSectionsContent, false);
            editor.AddInfoSection("ViewFrustum Culling", HandleViewFrustumCulling, false);
            editor.AddInfoSection("Collision", HandleCollision, false);
            editor.AddInfoSection("Raycast", HandleRaycast, true);

            boundsRenderer       = new DebugBoxLineRenderer(diContainer);
            boundsRenderer.Color = IColor.Red;
            boundsRenderer.Material.LinkTransformsTo(camera);
            boundsRenderer.Material.LinkTransformsTo(world: worldTransform);
            AddDisposable(boundsRenderer);

            planeRenderer = new DebugPlaneRenderer(diContainer);
            planeRenderer.Material.LinkTransformsTo(camera);
            planeRenderer.Material.LinkTransformsTo(world: worldTransform);
            AddDisposable(planeRenderer);

            frustumRenderer = new DebugHexahedronLineRenderer(diContainer);
            frustumRenderer.Material.LinkTransformsTo(camera);
            frustumRenderer.Material.LinkTransformsTo(world: worldTransform);
            AddDisposable(frustumRenderer);

            triangleRenderer = new DebugTriangleLineRenderer(diContainer);
            triangleRenderer.Material.LinkTransformsTo(camera);
            triangleRenderer.Material.LinkTransformsTo(world: worldTransform);
            AddDisposable(triangleRenderer);

            rayRenderer = new DebugLineRenderer(diContainer);
            rayRenderer.Material.LinkTransformsTo(camera);
            rayRenderer.Material.LinkTransformsTo(world: worldTransform);
            AddDisposable(rayRenderer);

            worldRenderer = new WorldRenderer(diContainer.ExtendedWith(camera, locationBuffer));
            AddDisposable(worldRenderer);
        }