Code Monkey home page Code Monkey logo

Comments (11)

Geniok avatar Geniok commented on May 27, 2024 1

Is it possible to do this without any modification of the Wicked Engine?
It used to be more convenient, it was possible to directly set the render dimensions, without being tied to the dimensions of a particular window.
Now the engine relies on the size of the window for its work, automatically tracking changes in its size, which reduced flexibility, in my opinion.

from wickedengine.

turanszkij avatar turanszkij commented on May 27, 2024

Yes, you can modify the logic in the wiApplication.cpp. The default behaviour is that in SetWindow(), we set the canvas size to the size of the window, and also create a swapchain of the same size. The swapchain is the final texture that will be presented to the window. All the other rendering by RenderPath3D and RenderPath2D will use other internal textures that will be sized relative to the size of the canvas.
You can change this logic and size your canvas however you want, and draw to the swapchain however you want.

from wickedengine.

turanszkij avatar turanszkij commented on May 27, 2024

In the Editor it is currently possible to set a fixed resolution in the config.ini, and if you set it to borderless, then the window cannot be resized:

width = 1920
height = 1080
borderless = true

How do you want to set a custom resolution and what should happen with window resize? Stretch render resolution to window size?

from wickedengine.

Geniok avatar Geniok commented on May 27, 2024

Hello!
I'm trying to create a small editor. I need the render size to change dynamically when the window size changes.
Editor

In the "Scene" window I display render Path -> lastPostprocessRT.
Now the render size is set by the size of the window itself. Which leads to unnecessary waste of resources.

from wickedengine.

Geniok avatar Geniok commented on May 27, 2024

I also need to change the rendering proportions:
Editor_2

from wickedengine.

turanszkij avatar turanszkij commented on May 27, 2024

You can change the size of the canvas (RenderPath3D is a canvas) and the render resources will be resized to match. This is how the editor works, but the canvas size is set from the window size (from the WM_RESIZE OS message if I remember correctly), instead you can set it to your desired size.

from wickedengine.

Geniok avatar Geniok commented on May 27, 2024

Hello!

Not certainly in that way. In the editor example, the WM_SIZE handler calls the editor.SetWindow(hWnd) method, and from it the canvas.init(window) method is called, which adjusts the size of the Canvas each time the window is resized.
Directly calling wi::RenderPath3D.width = 300 or wi::RenderPath3D.height= 500 does not affect the size of the Canvas .
Previously, you could manually specify the Canvas size and it was much more flexible and convenient.

If you call the canvas.init(width, height) method each time, if necessary, change the render size, then the final render size does not change, but remains equal to the window size, since further in the RenderPath2D::Update(float dt) method the sizes are again redefined equal the size of the main window.

DirectXRenderPath -> wi::RenderPath3D

DirectXRenderPath* renderPath;

if (imageRectMax.x != renderPath->width || imageRectMax.y != renderPath->height) 
{
        renderPath->setSize(Vector2(imageRectMax.x, imageRectMax.y)); 
}
void DirectXRenderPath::setSize(const Vector2& size) 
{

	this->width = size.x;                     <--- not work

	this->height = size.y;

	this->init(size.x, size.y);               <--- not work

	ResizeLayout();
}
void RenderPath2D::Update(float dt)
{
	XMUINT2 internalResolution = GetInternalResolution();

	if (current_buffersize.x != internalResolution.x || current_buffersize.y != internalResolution.y)
	{
		ResizeBuffers();
	}
	if (current_layoutscale != GetDPIScaling())
	{
		ResizeLayout();
	}

from wickedengine.

turanszkij avatar turanszkij commented on May 27, 2024

You can manage your own renderpath and then the application will not resize it for you and not interfere. This renderpath you don't activate on the application, but you call its Update,Render etc. functions yourself. Then you can draw the render result of your render path on the screen wherever you want using the image renderer. For example you can get the last post process render texture from RenderPath3D with GetLastPostprocessRT function.

from wickedengine.

Geniok avatar Geniok commented on May 27, 2024

There is one problem. The fact is that I want to display the ImGUI interface also using WickedEngine, as is done in the ImGUI Example.
So I need WickedEngine to track the window, but at the same time I can directly set the render resolution.

Until 04/22/21, I could set the render resolution separately using the GraphicsDevice_DX12::SetResolution(int width, int height) method, which was later removed, breaking backward compatibility.

The solution that I see is to create a window with ImGUI yourself, without using WickedEngine, and take only render results from WickedEngine using GetLastPostprocessRT. But then you won’t be able to use WickedEngine methods for selecting objects in a window, etc.

Or somehow decouple the render resolution from the window resolution. But I can't find a suitable method in GraphicsDevice_DX12. In all the examples that I was able to find, the render resolution coincides with the window resolution.

from wickedengine.

turanszkij avatar turanszkij commented on May 27, 2024

The SetResolution was removed because now multiple windows (swapchains) can be created. But the base simple Application class only handles one. It should be possible to modify only the Application class to do what you want. You can override the Application class for example, or not use it, as it is just some high level logic tying engine functions together at the top level.

from wickedengine.

Geniok avatar Geniok commented on May 27, 2024

Thank you.
I'll try to come up with something.

from wickedengine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.