Skip to content

Commit

Permalink
ed ren RT_ObjPrv3D
Browse files Browse the repository at this point in the history
  • Loading branch information
cryham committed Dec 2, 2024
1 parent 97a4f87 commit b96e57e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 20 deletions.
2 changes: 1 addition & 1 deletion data/materials/SR3.compositor
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ compositor_node Rtt_Terrain

// 🧊 3d preview other scene single object,veget
//------------------------------------------------------------------------------------
compositor_node Rtt_PreView3D
compositor_node Rtt_ObjPrv3D
{
in 0 rt_output

Expand Down
34 changes: 21 additions & 13 deletions src/editor/App_Render2tex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,10 @@ using namespace Ogre;
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
void App::CreateRnd2Tex()
{
const char* strWs[RT_ALL] = {
LogO("C-+E ed Create Rnd2Tex");
const char* strWs[RT_ALL] = { // names in SR3.compositor
"Rtt_RoadDens", "Rtt_RoadPreview", "Rtt_Terrain",
// "SR3_Render1",
"Rtt_View3D",
"Rtt_PreView3D"};
"Rtt_View3D", "Rtt_ObjPrv3D"};

auto* texMgr = mSceneMgr->getDestinationRenderSystem()->getTextureGpuManager();
auto* wsMgr = mRoot->getCompositorManager2();
Expand All @@ -50,7 +49,7 @@ void App::CreateRnd2Tex()

for (int i=0; i < RT_ALL; ++i)
{
bool full = i == RT_View3D, prv3D = i == RT_PreView3D;
bool view3D = i == RT_View3D, prv3D = i == RT_ObjPrv3D, ter = i == RT_Terrain;
auto& r = rt[i];
String si = toStr(i); //, sMtr = "road_mini_"+si;
{
Expand Down Expand Up @@ -99,7 +98,7 @@ void App::CreateRnd2Tex()
r.cam->setFarClipDistance(50000); // r.cam->setUseRenderingDistance(true);
r.cam->setAspectRatio(1.0);

if (!full) // ortho proj
if (!view3D) // ortho 2d proj
{ r.cam->setProjectionType(PT_ORTHOGRAPHIC);
r.cam->setOrthoWindow(tws, tws);
// r.cam->setOrthoWindow(tws / div, tws / div); // todo: ?
Expand All @@ -113,26 +112,33 @@ void App::CreateRnd2Tex()
// r.cam->setCastShadows(false);
}

// 🪄 Workspace ----
const String name( "EdRttWrk" + si ); // created from code
if( !wsMgr->hasWorkspaceDefinition( name ) )
// 🪄 Workspace def ----
String wsName( "EdRttWrk" + si ); // created from code
/*if (view3D) // || ter) // todo: ..
{ int ii = i + 2;
auto si = toStr(ii+1);
wsName = "SR3_New_WS"+si;
CreateCompositor(ii, 0, 1.f, 1.f); // ignored
}else
*/
if( !wsMgr->hasWorkspaceDefinition( wsName ) )
{
auto* w = wsMgr->addWorkspaceDefinition( name );
auto* w = wsMgr->addWorkspaceDefinition( wsName );
// w->mEnableForwardPlus = false;
w->connectExternal( 0, strWs[i], 0 );
}else
LogO("Workspace already exists: "+name);
LogO("Workspace already exists: "+wsName);

// #define MANUAL_RTT_UPD // todo: terrain shadowed..?

// add Workspace
LogO(String("--++ WS add: Ed ")+strWs[i]+", all: "+toStr(wsMgr->getNumWorkspaces()));
LogO(String("--++ WS add: Ed ")+strWs[i]+" "+wsName+" all: "+toStr(wsMgr->getNumWorkspaces()));

CompositorChannelVec chan(1);
chan[0] = r.rtt;

auto* cam = prv3D ? prvScene.cam : r.cam;
r.ws = wsMgr->addWorkspace( scMgr, chan, cam, name,
r.ws = wsMgr->addWorkspace( scMgr, chan, cam, wsName,
#ifndef MANUAL_RTT_UPD
true, 2 /*-1 ?*/ ); //! slower
// r.ws->setEnabled(false);
Expand Down Expand Up @@ -271,6 +277,8 @@ void App::DestroyEdHud()
// 💥 destroy
void App::DestroyRnd2Tex()
{
LogO("D-=E ed Destroy Rnd2Tex");

auto* texMgr = mSceneMgr->getDestinationRenderSystem()->getTextureGpuManager();
auto* cmpMgr = mRoot->getCompositorManager2();

Expand Down
10 changes: 5 additions & 5 deletions src/editor/CApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ class App : public BaseApp
Ogre::Real asp = 4.f/3.f, xm1 = -1.f, ym1 = 1.f, xm2 = 1.f, ym2 = -1.f;

// 🖼️ rtt render to texture --------
enum ERnd2Tex
enum ERnd2Tex // _top view
{ RT_RoadDens, // roadDensity.png road (on terrain) map to exclude grass,trees
RT_RoadPrv, // road.png minimap road preview, colors
RT_Terrain, // terrain.png minimap terrain
RT_View3D, // view.jpg preview camera, track 3d view
RT_PreView3D, // 3d preview, object
RT_RoadPrv, // road.png minimap 🛣️ road preview, colors, only main road
RT_Terrain, // terrain.png minimap ⛰️ terrain also 🌊 fluids, rivers
RT_View3D, // _3d view.jpg preview camera, track 3d view, all
RT_ObjPrv3D, // _3d model preview, object or veget
RT_ALL
};
struct SRndTrg
Expand Down
2 changes: 1 addition & 1 deletion src/editor/Gui_Init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ void CGui::InitGui()
sv= &svMiniNum; sv->strMap[App::RT_ALL ] = "ALL";
sv->strMap[App::RT_RoadDens] = "Road Density"; sv->strMap[App::RT_RoadPrv ] = "Road Preview"; // todo: TR(..
sv->strMap[App::RT_Terrain ] = "Terrain Preview"; sv->strMap[App::RT_View3D ] = "Track View";
sv->strMap[App::RT_PreView3D] = "Object View";
sv->strMap[App::RT_ObjPrv3D] = "Object View";
sv->Init("MiniNum", &pSet->num_mini, 0, App::RT_ALL-1); sv->DefaultI(1); Sev(MiniNum);

// sv= &svTerUpd; sv->Init("TerUpd", &pSet->ter_skip, 0, 20); sv->DefaultI(1); //; todo: restore
Expand Down

0 comments on commit b96e57e

Please sign in to comment.