-
Автор темы
- #1
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
I haven't seen public code of mirrorcam ported to window, only some attempts
Steps:
1. Create texture for custom render target
2. In RenderView after rendering normal view, render our mirrorcam to texture
3. Use our texture in UI renderer - directly in RenderView, in PaintTraverse or in D3D renderer.
We won't use raw DirectX functions to achieve it (in queued graphics mode it won't work properly at all probably), but engine's materialsystem.
Classes:
Code:
Step 1. Create render target
Engine heavily discourage us from allocating new render targets when game is already initialized, but we can force it and I haven't got any problems with it.
Code:
You can try to skip EndRenderTargetAllocation, everything works fine that way for me and you don't get stutter on allocation (EndRenderTargetAllocation simulates alt+tab).
Step 2. Render mirrorcam to texture
We will render custom views in RenderView hook.
Code:
After applying this step your FPS should drop (indicator that we're rendering second view), but there should be nothing new on screen - because you're rendering to off-screen texture.
Step 3. Render texture using materialsystem
Now we need to draw mirrorcam to screen. The texture can be accessed by name in materials:
Code:
You can create that material just like you're doing it for chams (if you don't know how look at forums for this). We can now render rectangle on screen using that material:
Code:
You can render it directly after RenderView or in PaintTraverse if you do UI there. Anywhere during engine rendering should work (probably). This way cannot be used in EndScene or Present.
Step 3B. Alternative: Render using raw DirectX
My UI renderer uses D3D and I wanted to use texture there. You can find DirectX texture in ITexture (CTexture):
Code:
Steps:
1. Create texture for custom render target
2. In RenderView after rendering normal view, render our mirrorcam to texture
3. Use our texture in UI renderer - directly in RenderView, in PaintTraverse or in D3D renderer.
We won't use raw DirectX functions to achieve it (in queued graphics mode it won't work properly at all probably), but engine's materialsystem.
Classes:
Для просмотра содержимого вам необходимо авторизоваться.
Code:
Для просмотра содержимого вам необходимо авторизоваться.
Step 1. Create render target
Engine heavily discourage us from allocating new render targets when game is already initialized, but we can force it and I haven't got any problems with it.
Code:
Для просмотра содержимого вам необходимо авторизоваться.
You can try to skip EndRenderTargetAllocation, everything works fine that way for me and you don't get stutter on allocation (EndRenderTargetAllocation simulates alt+tab).
Step 2. Render mirrorcam to texture
We will render custom views in RenderView hook.
Code:
Для просмотра содержимого вам необходимо авторизоваться.
After applying this step your FPS should drop (indicator that we're rendering second view), but there should be nothing new on screen - because you're rendering to off-screen texture.
Step 3. Render texture using materialsystem
Now we need to draw mirrorcam to screen. The texture can be accessed by name in materials:
Code:
Для просмотра содержимого вам необходимо авторизоваться.
You can create that material just like you're doing it for chams (if you don't know how look at forums for this). We can now render rectangle on screen using that material:
Code:
Для просмотра содержимого вам необходимо авторизоваться.
You can render it directly after RenderView or in PaintTraverse if you do UI there. Anywhere during engine rendering should work (probably). This way cannot be used in EndScene or Present.
Step 3B. Alternative: Render using raw DirectX
My UI renderer uses D3D and I wanted to use texture there. You can find DirectX texture in ITexture (CTexture):
Code:
Для просмотра содержимого вам необходимо авторизоваться.
Последнее редактирование: