Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }