32#include <IconsForkAwesome.h>
33#include <imgui_internal.h>
38#pragma warning(disable: 4127)
49 template<
typename T,
bool SeparateActivate,
typename Pred>
50 void RegisterUndo(
Editor& editor,
PushConstantType Type,
const T& oldVal,
const T& newVal,
const char* name, Pred&& dataSetter )
53 if ( !SeparateActivate || ImGui::IsItemActivated() )
58 if ( ImGui::IsItemDeactivatedAfterEdit() )
70 if ( selection !=
nullptr )
72 return selection->
getNode().requiredComponentMask() &
to_U32( componentType );
78 template<
typename Pred>
81 if ( instanceRoot !=
nullptr )
83 predicate( baseMaterial, instanceRoot );
96 template<
typename Pred>
99 ImGui::SameLine( ImGui::GetWindowContentRegionMax().x - 40 );
100 ImGui::PushID( 4321234 +
id++ );
105 if ( ImGui::SmallButton(
"A" ) )
109 if ( ImGui::IsItemHovered( ImGuiHoveredFlags_AllowWhenDisabled ) )
111 ImGui::SetTooltip(
"Apply to all instances" );
123 ImGui::SameLine( ImGui::GetWindowContentRegionMax().x - 15 );
124 ImGui::PushID( 4321234 +
id++ );
129 if ( ImGui::SmallButton(
"T" ) )
133 if ( tex != INVALID_HANDLE<Texture> && ImGui::IsItemHovered( ImGuiHoveredFlags_AllowWhenDisabled ) )
167 bool sceneChanged =
false;
168 if ( cam ==
nullptr )
173 const char* camName = cam->resourceName().c_str();
174 const U64 camID =
_ID( camName );
175 ImGui::PushID(
to_I32( camID ) * 54321 );
177 if ( ImGui::CollapsingHeader( camName, ImGuiTreeNodeFlags_DefaultOpen ) )
180 ImGui::PushID( modeStr );
181 ImGui::LabelText(
"",
"Camera Mode: [ %s ]", modeStr );
189 camField.
_name =
"Eye";
194 camField.
_dataSetter = [cam](
const void* val )
noexcept
198 sceneChanged =
processField( camField ) || sceneChanged;
201 constexpr const char* CamRotateLabels[] = {
207 camField.
_name =
"Euler";
208 camField.
_labels = CamRotateLabels;
209 camField.
_tooltip =
"Change camera orientation using euler angles( degrees).\nP = Pitch, Y = Yaw, R = Roll";
214 camField.
_dataSetter = [cam](
const void* e )
noexcept
218 sceneChanged =
processField( camField ) || sceneChanged;
221 constexpr const char* CamSpeedLabels[] = {
228 camField.
_name =
"Speed";
230 camField.
_labels = CamSpeedLabels;
234 camField.
_tooltip =
"Change camera speed factor. (units / second) \nT = Turn speed, M = Move speed, Z = Zoom speed";
237 camField.
_dataSetter = [cam](
const void* e )
noexcept
240 cam->speedFactor( speed );
242 sceneChanged =
processField( camField ) || sceneChanged;
247 camField.
_name =
"Forward";
252 sceneChanged =
processField( camField ) || sceneChanged;
257 camField.
_name =
"Aspect";
261 camField.
_data = &aspect;
262 camField.
_dataSetter = [cam](
const void* a )
noexcept
266 sceneChanged =
processField( camField ) || sceneChanged;
271 camField.
_name =
"FoV (horizontal)";
275 camField.
_data = &horizontalFoV;
276 camField.
_dataSetter = [cam](
const void* fov )
noexcept
280 sceneChanged =
processField( camField ) || sceneChanged;
285 camField.
_name =
"zPlanes";
301 sceneChanged =
processField( camField ) || sceneChanged;
307 camField.
_name =
"Ortho";
316 sceneChanged =
processField( camField ) || sceneChanged;
321 worldMatrixField.
_name =
"View Matrix";
325 worldMatrixField.
_data = &viewMatrix;
337 projMatrixField.
_name =
"Projection Matrix";
338 projMatrixField.
_data = &projMatrix;
346 bool drawFustrum = g_debugFrustums.find( camID ) != eastl::cend( g_debugFrustums );
347 ImGui::PushID(
to_I32( camID ) * 123456 );
348 if ( ImGui::Checkbox(
"Draw debug frustum", &drawFustrum ) )
356 g_debugFrustums.erase( camID );
361 auto& [frust, colour, realtime] = g_debugFrustums[camID];
362 ImGui::Checkbox(
"Update realtime", &realtime );
363 const bool update = realtime || ImGui::Button(
"Update frustum" );
368 ImGui::PushID( cam->resourceName().c_str() );
369 ImGui::ColorEdit3(
"Frust Colour", colour._v, ImGuiColorEditFlags_DefaultOptions_ );
375 F32 radius = cam->maxRadius();
377 camField.
_name =
"MAX Radius";
381 camField.
_data = &radius;
382 camField.
_dataSetter = [cam](
const void* radius )
noexcept
384 cam->maxRadius( *
static_cast<const F32*
>(radius) );
386 sceneChanged =
processField( camField ) || sceneChanged;
389 F32 radius = cam->maxRadius();
391 camField.
_name =
"MIN Radius";
395 camField.
_data = &radius;
396 camField.
_dataSetter = [cam](
const void* radius )
noexcept
398 cam->maxRadius( *
static_cast<const F32*
>(radius) );
400 sceneChanged =
processField( camField ) || sceneChanged;
403 F32 radius = cam->curRadius();
405 camField.
_name =
"Current Radius";
409 camField.
_data = &radius;
410 camField.
_dataSetter = [cam](
const void* radius )
noexcept
412 cam->curRadius( *
static_cast<const F32*
>(radius) );
414 sceneChanged =
processField( camField ) || sceneChanged;
429 for (
const auto& it : g_debugFrustums )
431 const auto& [frustum, colour, realtime] = it.second;
443 bool sceneChanged =
false;
445 bool isLockedField =
false;
446 bool fieldWasOpen =
false;
451 isLockedField =
true;
458 const char* fieldName = fieldNameStr.c_str();
459 const U64 fieldHash =
_ID( fieldName );
460 if ( !isLockedField )
462 for (
const U64 p : s_openProperties )
464 if ( p == fieldHash )
471 if ( comp->
fields().empty() )
474 ImGui::CollapsingHeader( fieldName, ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_Bullet );
479 if ( ImGui::CollapsingHeader( fieldName, ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_SpanAvailWidth | ((fieldWasOpen || fieldAlwaysOpen) ? ImGuiTreeNodeFlags_DefaultOpen : 0u) ) )
483 for (
U64& p : s_openProperties )
494 ImGui::SameLine( xOffset );
495 if ( ImGui::Button( ICON_FK_SEARCH
" INSPECT", ImVec2( smallButtonWidth, 20 ) ) )
499 if ( !isLockedField && comp->componentType() !=
ComponentType::COUNT && !IsRequiredComponentType( sgnNode, comp->componentType() ) )
502 if ( ImGui::Button( ICON_FK_MINUS
" REMOVE", ImVec2( smallButtonWidth, 20 ) ) )
513 ImGui::SameLine( ImGui::GetWindowSize().x - 80.f );
515 ImGui::PushID(
to_I32( fieldHash ) );
516 if ( ImGui::Checkbox( ICON_FK_LOCK
" ", &fieldLocked ) )
528 if ( ImGui::IsItemHovered() )
530 ImGui::SetTooltip(
"Always keep this component visible in the editor regardless of the currently selected scene node" );
531 skipAutoTooltip(
true );
544 const U32 componentMask = sgnNode->componentMask();
548 if ( probe !=
nullptr )
550 ImGui::Text(
"Probe ID: %d", probe->
getGUID());
553 Light* light =
nullptr;
556 light = sgnNode->
get<SpotLightComponent>();
560 light = sgnNode->
get<PointLightComponent>();
566 if ( light !=
nullptr )
568 if ( light->castsShadows() )
570 if ( ImGui::CollapsingHeader(
"Light Shadow Settings", ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_SpanAvailWidth ) )
578 for (
U8 face = 0u; face < 6u; ++face )
601 for (
U8 split = 0u; split < dirLight->csmSplitCount(); ++split )
619 if ( ImGui::CollapsingHeader(
"Scene Shadow Settings", ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_SpanAvailWidth ) )
622 auto& activeSceneState = projectManager->activeProject()->getActiveScene()->state();
625 F32 bleedBias = activeSceneState->lightBleedBias();
627 tempField.
_name =
"Light bleed bias";
631 tempField.
_data = &bleedBias;
633 tempField.
_range = { 0.0f, 1.0f };
634 tempField.
_dataSetter = [&activeSceneState](
const void* bias )
noexcept
636 activeSceneState->lightBleedBias( *
static_cast<const F32*
>(bias) );
638 sceneChanged =
processField( tempField ) || sceneChanged;
641 F32 shadowVariance = activeSceneState->minShadowVariance();
643 tempField.
_name =
"Minimum variance";
647 tempField.
_data = &shadowVariance;
648 tempField.
_range = { 0.00001f, 0.99999f };
650 tempField.
_dataSetter = [&activeSceneState](
const void* variance )
noexcept
652 activeSceneState->minShadowVariance( *
static_cast<const F32*
>(variance) );
654 sceneChanged =
processField( tempField ) || sceneChanged;
661 for (
U64& p : s_openProperties )
663 if ( p == fieldHash )
678 constexpr F32 buttonWidth = 105.0f;
679 constexpr F32 smallButtonWidth = 90.0f;
681 skipAutoTooltip(
false );
683 bool sceneChanged =
false;
684 F32 xOffset = ImGui::GetWindowSize().x * 0.5f - (smallButtonWidth * 2);
695 bool lockSolutionExplorer =
false;
697 if ( selectedCamera !=
nullptr )
701 else if ( hasSelections )
706 if ( sgnNode !=
nullptr )
708 ImGui::PushID( sgnNode->name().c_str() );
724 ImGui::SameLine( ImGui::GetWindowSize().x - 80.f );
726 if ( ImGui::Checkbox( ICON_FK_LOCK
" ", &selectionLocked ) )
728 if ( selectionLocked )
737 if ( ImGui::IsItemHovered() )
739 ImGui::SetTooltip(
"When ticked, prevents selection of a different node" );
740 skipAutoTooltip(
true );
742 if ( selectionLocked )
744 lockSolutionExplorer =
true;
749 if ( sgnNode->parent() ==
nullptr )
755 if ( nodeComp !=
nullptr && lockedGUID != nodeComp->
getGUID() &&
printComponent( sgnNode, nodeComp, xOffset, smallButtonWidth))
763 if ( lockedGUID != comp->getGUID() &&
printComponent( sgnNode, comp, xOffset, smallButtonWidth ) )
771 ImGui::SameLine( ImGui::GetWindowSize().x * 0.5f - (buttonWidth * 0.5f) );
772 if ( ImGui::Button( ICON_FK_FLOPPY_O
" Save Node", ImVec2( buttonWidth, 25 ) ) )
781 const auto validComponentToAdd = [
this, &crtSelections](
const ComponentType type ) ->
bool
793 bool missing =
false;
797 if ( sgn !=
nullptr && !( sgn->componentMask() &
to_U32( type ) ) )
807 xOffset = ImGui::GetWindowSize().x - buttonWidth - 20.0f;
811 ImGui::SameLine( xOffset );
812 if ( ImGui::Button( ICON_FK_PLUS
" ADD NEW", ImVec2( buttonWidth, 25 ) ) )
818 if ( ImGui::BeginPopup(
"COMP_SELECTION_GROUP" ) )
822 const U32 componentBit = 1 << i;
841 if ( ImGui::BeginPopupModal(
"Add new component",
nullptr, ImGuiWindowFlags_AlwaysAutoResize ) )
846 if ( ImGui::Button(
"OK", ImVec2( 120, 0 ) ) )
853 ImGui::CloseCurrentPopup();
856 ImGui::SetItemDefaultFocus();
858 if ( ImGui::Button(
"Cancel", ImVec2( 120, 0 ) ) )
861 ImGui::CloseCurrentPopup();
869 ImGui::Text(
"Please select a scene node \n to inspect its properties" );
891 Scene* activeScene =
context().
kernel().projectManager()->activeProject()->getActiveScene();
897 Scene* activeScene =
context().
kernel().projectManager()->activeProject()->getActiveScene();
898 return activeScene->sceneGraph()->findNode( guid );
903 if ( field.
_labels ==
nullptr )
908 const auto printFieldName = [&field]()
910 ImGui::Text(
"[%s]", field.
_name.c_str() );
913 switch ( field.
_type )
932 ret = ImGui::Button( field.
_name.c_str() );
943 ImGui::PushItemWidth( ImGui::GetContentRegionAvail().x * 0.5f );
946 }ImGui::PopItemWidth();
959 if ( entryCount > 0 && entryStart <= entryCount )
961 ImGui::PushID( field.
_name.c_str() );
963 const U8 crtMode = field.
get<
U8>();
967 for (
U8 n = entryStart; n < entryCount; ++n )
969 const bool isSelected = crtMode == n;
973 typeUndo.
_name =
"Drop Down Selection";
987 ImGui::SetItemDefaultFocus();
1011 bbField.
_name =
"Min ";
1015 bbField.
_data = bbMin;
1028 bbField.
_name =
"Max ";
1032 bbField.
_data = bbMax;
1045 bbField.
_name =
"Half Extents ";
1049 bbField.
_data = halfExtent;
1055 bbField.
_name =
"Center ";
1059 bbField.
_data = bbCenter;
1074 bbField.
_name =
"Center ";
1079 bbField.
_data = position._v;
1084 bbField.
_name =
"Half Extents ";
1092 for (
U8 i = 0; i < 3; ++i )
1100 bbField.
_data = axis[i]._v;
1114 bbField.
_name =
"Center ";
1119 bbField.
_data = center;
1131 bbField.
_name =
"Radius ";
1136 bbField.
_data = &radius;
1149 assert( !field.
_dataSetter &&
"Need direct access to memory" );
1155 assert( !field.
_dataSetter &&
"Need direct access to memory" );
1161 if ( !skipAutoTooltip() && ImGui::IsItemHovered( ImGuiHoveredFlags_AllowWhenDisabled ) )
1171 if ( transform ==
nullptr )
1176 DIVIDE_ASSERT(!hex,
"PropertyWindow::processTransform error: Hex fields not supported!");
1180 const bool transformReadOnly = readOnly || transform->editorLockPosition();
1181 const bool rotationReadOnly = readOnly || transform->editorLockRotation();
1182 const bool scaleReadOnly = readOnly || transform->editorLockScale();
1190 if ( Util::DrawVec<F32, 3, true>( ImGuiDataType_Float,
"Position", pos.
_v, transformReadOnly ).wasChanged )
1193 RegisterUndo<vec3<F32>,
false>(
_parent,
1197 "Transform position",
1204 if ( Util::DrawVec<F32, 3, true>( ImGuiDataType_Float,
"Rotation", rot.
_v, rotationReadOnly ).wasChanged )
1207 RegisterUndo<vec3<F32>,
false>(
_parent,
1211 "Transform rotation",
1221 bool scaleChanged =
false;
1222 if ( nonUniformScalingEnabled )
1224 scaleChanged = Util::DrawVec<F32, 3, true>( ImGuiDataType_Float,
"Scale", scale.
_v, scaleReadOnly, 1.f ).wasChanged;
1228 if ( Util::DrawVec<F32, 1, true>( ImGuiDataType_Float,
"Scale", scale.
_v, scaleReadOnly, 1.f ).wasChanged )
1230 scaleChanged =
true;
1231 scale.
z = scale.
y = scale.
x;
1239 for (
U8 i = 0; i < 3; ++i )
1243 RegisterUndo<vec3<F32>,
false>(
_parent,
1255 if ( ImGui::Checkbox(
"Non-uniform scaling", &nonUniformScalingEnabled ) )
1258 RegisterUndo<bool, false>(
_parent,
1262 "Non-uniform scaling",
1263 [transform](
const bool& oldVal )
noexcept
1268 transform->scalingMode( newMode );
1271 if ( ImGui::IsItemHovered() )
1273 ImGui::SetTooltip(
"Toggle per-axis independent scale values.\nAllow shear/tear/squash/etc.\nBreaks the scene hierarchy in many ways but should be fine for leaf nodes" );
1274 skipAutoTooltip(
true );
1277 if ( ImGui::Button( ICON_FK_UNDO
" RESET", ImVec2( 90.f, 20 ) ) )
1281 RegisterUndo<TransformValues, false>(
_parent,
1299 if ( material ==
nullptr )
1314 if ( ImGui::BeginCombo(
"Stage", crtStageName, ImGuiComboFlags_PopupAlignLeft ) )
1319 const bool isSelected = currentStagePass._stage == mode;
1323 currentStagePass._stage = mode;
1327 ImGui::SetItemDefaultFocus();
1332 if ( ImGui::BeginCombo(
"PassType", crtPassName, ImGuiComboFlags_PopupAlignLeft ) )
1337 const bool isSelected = currentStagePass._passType == pass;
1341 currentStagePass._passType = pass;
1345 ImGui::SetItemDefaultFocus();
1353 ImGui::SliderScalar(
"Variant", ImGuiDataType_U8, ¤tStagePass._variant, &min, &max );
1357 ImGui::SliderScalar(
"Pass", ImGuiDataType_U16, ¤tStagePass._pass, &min, &max );
1360 ImGui::InputScalar(
"Index", ImGuiDataType_U16, ¤tStagePass._index,
nullptr,
nullptr, (hex ?
"%08X" :
nullptr), (hex ? ImGuiInputTextFlags_CharsHexadecimal : 0u) );
1364 string shaderName =
"None";
1369 if ( shaderHandle != INVALID_HANDLE<ShaderProgram> )
1371 program =
Get( shaderHandle );
1372 shaderName = program->resourceName().c_str();
1377 if ( ImGui::CollapsingHeader( (
"Program: " + shaderName).c_str() ) )
1379 if ( program !=
nullptr )
1384 const char* stages[] = {
"PS",
"VS",
"GS",
"HS",
"DS",
"CS" };
1390 ImGui::Text(
"Defines: " );
1392 for (
const auto& [text, appendPrefix] : module.
_defines )
1394 ImGui::Text( text.c_str() );
1396 if ( ImGui::Button(
"Open Source File" ) )
1399 if ( textEditor.
empty() )
1405 if (
openFile( textEditor.
string(), Paths::Shaders::GLSL::g_GLSLShaderLoc, module.
_sourceFile.c_str() ) != FileError::NONE )
1414 ImGui::Text(
"Global Defines: " );
1416 for (
const auto& [text, appendPrefix] :
descriptor._globalDefines )
1418 ImGui::Text( text.c_str() );
1424 if ( ImGui::Button(
"Rebuild from source" ) && !readOnly )
1427 bool skipped =
false;
1442 const size_t stateHash =
GetHash(stateBlock);
1443 static bool renderStateWasOpen =
false;
1444 if ( !ImGui::CollapsingHeader(
Util::StringFormat(
"Render State: {}", stateHash ).c_str(), (renderStateWasOpen ? ImGuiTreeNodeFlags_DefaultOpen : 0u) | ImGuiTreeNodeFlags_SpanAvailWidth ) )
1446 renderStateWasOpen =
false;
1448 else if ( stateHash > 0 )
1450 renderStateWasOpen =
true;
1452 bool changed =
false;
1454 P32 colourWrite = stateBlock._colourWrite;
1455 constexpr const char*
const names[] = {
"R",
"G",
"B",
"A" };
1457 for (
U8 i = 0; i < 4; ++i )
1464 bool val = colourWrite.
b[i] == 1;
1465 if ( ImGui::Checkbox( names[i], &val ) )
1469 stateBlock._colourWrite.b[i] = oldVal;
1470 material->
setRenderStateBlock( stateBlock, currentStagePass._stage, currentStagePass._passType, currentStagePass._variant );
1472 colourWrite.
b[i] = val ? 1 : 0;
1473 stateBlock._colourWrite = colourWrite;
1479 F32 zBias = stateBlock._zBias;
1480 F32 zUnits = stateBlock._zUnits;
1483 tempField.
_name =
"ZBias";
1487 tempField.
_data = &zBias;
1488 tempField.
_range = { 0.0f, 1000.0f };
1490 tempField.
_dataSetter = [material, &stateBlock, tempPass](
const void* data )
1492 stateBlock._zBias = *
static_cast<const F32*
>(data);
1499 tempField.
_name =
"ZUnits";
1503 tempField.
_data = &zUnits;
1504 tempField.
_range = { 0.0f, 65536.0f };
1506 tempField.
_dataSetter = [material, &stateBlock, tempPass](
const void* data )
1508 stateBlock._zUnits = *
static_cast<const F32*
>(data);
1514 ImGui::Text(
"Tessellation control points: %d", stateBlock._tessControlPoints );
1517 CullMode cMode = stateBlock._cullMode;
1521 if ( ImGui::BeginCombo(
"Cull Mode", crtMode, ImGuiComboFlags_PopupAlignLeft ) )
1526 const bool isSelected = cMode == mode;
1531 cullUndo.
_name =
"Cull Mode";
1535 cullUndo.
_dataSetter = [material, &stateBlock, tempPass](
const I32& data )
1537 stateBlock._cullMode =
static_cast<CullMode>(data);
1543 stateBlock._cullMode = mode;
1548 ImGui::SetItemDefaultFocus();
1556 FillMode fMode = stateBlock._fillMode;
1558 if ( ImGui::BeginCombo(
"Fill Mode", crtMode, ImGuiComboFlags_PopupAlignLeft ) )
1563 const bool isSelected = fMode == mode;
1568 fillUndo.
_name =
"Fill Mode";
1572 fillUndo.
_dataSetter = [material, &stateBlock, tempPass](
const I32& data )
1574 stateBlock._fillMode =
static_cast<FillMode>(data);
1580 stateBlock._fillMode = mode;
1585 ImGui::SetItemDefaultFocus();
1592 U32 stencilReadMask = stateBlock._stencilMask;
1593 U32 stencilWriteMask = stateBlock._stencilWriteMask;
1594 if ( ImGui::InputScalar(
"Stencil mask", ImGuiDataType_U32, &stencilReadMask,
nullptr,
nullptr,
"%08X", ImGuiInputTextFlags_CharsHexadecimal ) )
1597 RegisterUndo<U32, false>(
_parent,
PushConstantType::UINT, stateBlock._stencilMask, stencilReadMask,
"Stencil mask", [material, &stateBlock, tempPass](
const U32& oldVal )
1599 stateBlock._stencilMask = oldVal;
1600 material->setRenderStateBlock( stateBlock, tempPass._stage, tempPass._passType, tempPass._variant );
1603 stateBlock._stencilMask = stencilReadMask;
1607 if ( ImGui::InputScalar(
"Stencil write mask", ImGuiDataType_U32, &stencilWriteMask,
nullptr,
nullptr,
"%08X", ImGuiInputTextFlags_CharsHexadecimal ) )
1610 RegisterUndo<U32, false>(
_parent,
PushConstantType::UINT, stateBlock._stencilWriteMask, stencilWriteMask,
"Stencil write mask", [material, &stateBlock, tempPass](
const U32& oldVal )
1612 stateBlock._stencilWriteMask = oldVal;
1613 material->setRenderStateBlock( stateBlock, tempPass._stage, tempPass._passType, tempPass._variant );
1616 stateBlock._stencilWriteMask = stencilWriteMask;
1622 if ( ImGui::BeginCombo(
"Depth function", crtMode, ImGuiComboFlags_PopupAlignLeft ) )
1627 const bool isSelected = stateBlock._zFunc == func;
1632 depthUndo.
_name =
"Depth function";
1636 depthUndo.
_dataSetter = [material, &stateBlock, tempPass](
const I32& data )
1643 stateBlock._zFunc = func;
1648 ImGui::SetItemDefaultFocus();
1655 bool stencilDirty =
false;
1656 U32 stencilRef = stateBlock._stencilRef;
1657 bool stencilEnabled = stateBlock._stencilEnabled;
1663 if ( ImGui::InputScalar(
"Stencil reference mask", ImGuiDataType_U32, &stencilRef,
nullptr,
nullptr,
"%08X", ImGuiInputTextFlags_CharsHexadecimal ) )
1666 RegisterUndo<U32, false>(
_parent,
PushConstantType::UINT, stateBlock._stencilRef, stencilRef,
"Stencil reference mask", [material, &stateBlock, tempPass](
const U32& oldVal )
1668 stateBlock._stencilRef = oldVal;
1669 material->setRenderStateBlock( stateBlock, tempPass._stage, tempPass._passType, tempPass._variant );
1671 stencilDirty =
true;
1677 if ( ImGui::BeginCombo(
"Stencil fail op", crtMode, ImGuiComboFlags_PopupAlignLeft ) )
1682 const bool isSelected = sFailOp == op;
1687 stencilUndo.
_name =
"Stencil fail op";
1691 stencilUndo.
_dataSetter = [material, &stateBlock, tempPass](
const I32& data )
1699 stencilDirty =
true;
1703 ImGui::SetItemDefaultFocus();
1712 if ( ImGui::BeginCombo(
"Stencil depth fail op", crtMode, ImGuiComboFlags_PopupAlignLeft ) )
1717 const bool isSelected = sZFailOp == op;
1722 stencilUndo.
_name =
"Stencil depth fail op";
1726 stencilUndo.
_dataSetter = [material, &stateBlock, tempPass](
const I32& data )
1734 stencilDirty =
true;
1738 ImGui::SetItemDefaultFocus();
1747 if ( ImGui::BeginCombo(
"Stencil pass op", crtMode, ImGuiComboFlags_PopupAlignLeft ) )
1752 const bool isSelected = sPassOp == op;
1758 stencilUndo.
_name =
"Stencil pass op";
1762 stencilUndo.
_dataSetter = [material, &stateBlock, tempPass](
const I32& data )
1770 stencilDirty =
true;
1774 ImGui::SetItemDefaultFocus();
1783 if ( ImGui::BeginCombo(
"Stencil function", crtMode, ImGuiComboFlags_PopupAlignLeft ) )
1788 const bool isSelected = sFunc == mode;
1794 stencilUndo.
_name =
"Stencil function";
1798 stencilUndo.
_dataSetter = [material, &stateBlock, tempPass](
const I32& data )
1806 stencilDirty =
true;
1810 ImGui::SetItemDefaultFocus();
1817 bool frontFaceCCW = stateBlock._frontFaceCCW;
1818 if ( ImGui::Checkbox(
"CCW front face", &frontFaceCCW ) )
1821 RegisterUndo<bool, false>(
_parent,
PushConstantType::BOOL, !frontFaceCCW, frontFaceCCW,
"CCW front face", [material, &stateBlock, tempPass](
const bool& oldVal )
1823 stateBlock._frontFaceCCW = oldVal;
1827 stateBlock._frontFaceCCW = frontFaceCCW;
1831 bool scissorEnabled = stateBlock._scissorTestEnabled;
1832 if ( ImGui::Checkbox(
"Scissor test", &scissorEnabled ) )
1835 RegisterUndo<bool, false>(
_parent,
PushConstantType::BOOL, !scissorEnabled, scissorEnabled,
"Scissor test", [material, &stateBlock, tempPass](
const bool& oldVal )
1837 stateBlock._scissorTestEnabled = oldVal;
1841 stateBlock._scissorTestEnabled = scissorEnabled;
1845 bool depthTestEnabled = stateBlock._depthTestEnabled;
1846 if ( ImGui::Checkbox(
"Depth test", &depthTestEnabled ) )
1849 RegisterUndo<bool, false>(
_parent,
PushConstantType::BOOL, !depthTestEnabled, depthTestEnabled,
"Depth test", [material, &stateBlock, tempPass](
const bool& oldVal )
1851 stateBlock._depthTestEnabled = oldVal;
1855 stateBlock._depthTestEnabled = depthTestEnabled;
1859 bool depthWriteEnabled = stateBlock._depthWriteEnabled;
1860 if ( ImGui::Checkbox(
"Depth write", &depthWriteEnabled ) )
1863 RegisterUndo<bool, false>(
_parent,
PushConstantType::BOOL, !depthWriteEnabled, depthWriteEnabled,
"Depth write", [material, &stateBlock, tempPass](
const bool& oldVal )
1865 stateBlock._depthWriteEnabled = oldVal;
1869 stateBlock._depthWriteEnabled = depthWriteEnabled;
1873 if ( ImGui::Checkbox(
"Stencil test", &stencilEnabled ) )
1876 RegisterUndo<bool, false>(
_parent,
PushConstantType::BOOL, !stencilEnabled, stencilEnabled,
"Stencil test", [material, &stateBlock, tempPass](
const bool& oldVal )
1878 stateBlock._stencilEnabled = oldVal;
1882 stencilDirty =
true;
1887 stateBlock._stencilRef = stencilRef;
1888 stateBlock._stencilEnabled = stencilEnabled;
1889 stateBlock._stencilFailOp = sFailOp;
1890 stateBlock._stencilZFailOp = sZFailOp;
1891 stateBlock._stencilPassOp = sPassOp;
1892 stateBlock._stencilFunc = sFunc;
1896 if ( changed && !readOnly )
1898 material->
setRenderStateBlock( stateBlock, currentStagePass._stage, currentStagePass._passType, currentStagePass._variant );
1903 static bool shadingModeWasOpen =
false;
1904 const ShadingMode crtMode = material->properties().shadingMode();
1906 if ( !ImGui::CollapsingHeader( crtModeName, (shadingModeWasOpen ? ImGuiTreeNodeFlags_DefaultOpen : 0u) | ImGuiTreeNodeFlags_SpanAvailWidth ) )
1908 shadingModeWasOpen =
false;
1912 skipAutoTooltip(
true );
1914 shadingModeWasOpen =
true;
1917 ImGui::PushItemWidth( 250 );
1918 if ( ImGui::BeginCombo(
"[Shading Mode]", crtModeName, ImGuiComboFlags_PopupAlignLeft ) )
1923 const bool isSelected = crtMode == mode;
1929 modeUndo.
_name =
"Shading Mode";
1932 modeUndo.
_dataSetter = [material, mode]( [[maybe_unused]]
const I32& data )
1934 material->properties().shadingMode( mode );
1938 material->properties().shadingMode( mode );
1942 ImGui::SetItemDefaultFocus();
1947 ImGui::PopItemWidth();
1951 ApplyAllButton(
id,
false, *material, [](
const Material& baseMaterial,
Material* matInstance )
1953 matInstance->properties().shadingMode( baseMaterial.properties().shadingMode() );
1956 bool fromTexture =
false;
1960 ImGui::PushItemWidth( 250 );
1964 material->properties().baseColour( col );
return true;
1969 ImGui::PopItemWidth();
1970 if ( fromTexture && ImGui::IsItemHovered( ImGuiHoveredFlags_AllowWhenDisabled ) )
1972 ImGui::SetTooltip(
"Albedo is sampled from a texture. Base colour possibly unused!" );
1973 skipAutoTooltip(
true );
1975 ApplyAllButton(
id, fromTexture || readOnly, *material, [](
const Material& baseMaterial,
Material* matInstance )
1977 matInstance->properties().baseColour( baseMaterial.properties().baseColour() );
1979 if ( PreviewTextureButton(
id, texture, !fromTexture ) )
1987 const bool ro = detailTex == INVALID_HANDLE<Texture>;
1988 ImGui::PushID( 4321234 +
id++ );
1989 if ( ro || readOnly )
1994 bool showTexture =
false;
1995 if ( ImGui::Button(
"Detail Texture" ) )
2000 if ( ro || readOnly )
2004 if ( ImGui::IsItemHovered( ImGuiHoveredFlags_AllowWhenDisabled ) )
2008 ImGui::SetTooltip(
"No detail texture specified!" );
2012 ImGui::SetTooltip(
Util::StringFormat(
"Preview texture : {}",
Get(detailTex)->assetName() ).c_str() );
2014 skipAutoTooltip(
true );
2017 if ( showTexture && !ro )
2024 const bool ro = normalTex == INVALID_HANDLE<Texture>;
2025 ImGui::PushID( 4321234 +
id++ );
2026 if ( ro || readOnly )
2030 bool showTexture =
false;
2031 if ( ImGui::Button(
"Normal Map" ) )
2036 if ( ro || readOnly )
2040 if ( ImGui::IsItemHovered( ImGuiHoveredFlags_AllowWhenDisabled ) )
2044 ImGui::SetTooltip(
"No normal map specified!" );
2048 ImGui::SetTooltip(
Util::StringFormat(
"Preview texture : {}",
Get(normalTex)->assetName() ).c_str() );
2050 skipAutoTooltip(
true );
2053 if ( showTexture && !ro )
2061 ImGui::PushItemWidth( 250 );
2065 material->properties().emissive( col );
return true;
2070 ImGui::PopItemWidth();
2071 if ( fromTexture && ImGui::IsItemHovered( ImGuiHoveredFlags_AllowWhenDisabled ) )
2073 ImGui::SetTooltip(
"Control managed by application (e.g. is overriden by a texture)" );
2074 skipAutoTooltip(
true );
2076 ApplyAllButton(
id, fromTexture || readOnly, *material, [](
const Material& baseMaterial,
Material* matInstance )
2078 matInstance->properties().emissive( baseMaterial.properties().emissive() );
2080 if ( PreviewTextureButton(
id, texture, !fromTexture ) )
2088 ImGui::PushItemWidth( 250 );
2092 material->properties().ambient( colour );
return true;
2097 ImGui::PopItemWidth();
2098 if ( fromTexture && ImGui::IsItemHovered( ImGuiHoveredFlags_AllowWhenDisabled ) )
2100 ImGui::SetTooltip(
"Control managed by application (e.g. is overriden by a texture)" );
2101 skipAutoTooltip(
true );
2103 ApplyAllButton(
id, fromTexture || readOnly, *material, [](
const Material& baseMaterial,
Material* matInstance )
2105 matInstance->properties().ambient( baseMaterial.properties().ambient() );
2107 if ( PreviewTextureButton(
id, texture, !fromTexture ) )
2117 F32 shininess = material->properties().shininess();
2121 tempField.
_name =
"Shininess";
2125 tempField.
_data = &shininess;
2127 tempField.
_dataSetter = [&material](
const void* s )
2129 material->properties().shininess( *
static_cast<const F32*
>(s) );
2132 ImGui::PushItemWidth( 175 );
2134 ImGui::PopItemWidth();
2136 ApplyAllButton(
id, fromTexture || readOnly, *material, [](
const Material& baseMaterial,
Material* matInstance )
2138 matInstance->properties().shininess( baseMaterial.properties().shininess() );
2143 ImGui::PushItemWidth( 250 );
2146 material->properties().specular( col );
return true;
2151 ImGui::PopItemWidth();
2152 if ( fromTexture && ImGui::IsItemHovered( ImGuiHoveredFlags_AllowWhenDisabled ) )
2154 ImGui::SetTooltip(
"Control managed by application (e.g. is overriden by a texture)" );
2156 ApplyAllButton(
id, fromTexture || readOnly, *material, [](
const Material& baseMaterial,
Material* matInstance )
2158 matInstance->properties().specular( baseMaterial.properties().specular() );
2160 if ( PreviewTextureButton(
id, texture, !fromTexture ) )
2164 skipAutoTooltip(
true );
2174 tempField.
_name =
"Metallic";
2177 tempField.
_readOnly = fromTexture || readOnly;
2180 tempField.
_tooltip =
"Control managed by application (e.g. is overriden by a texture)";
2182 tempField.
_data = &metallic;
2183 tempField.
_range = { 0.0f, 1.0f };
2184 tempField.
_dataSetter = [material](
const void* m )
2186 material->properties().metallic( *
static_cast<const F32*
>(m) );
2189 ImGui::PushItemWidth( 175 );
2191 ImGui::PopItemWidth();
2194 ApplyAllButton(
id, fromTexture || readOnly, *material, [](
const Material& baseMaterial,
Material* matInstance )
2196 matInstance->properties().metallic( baseMaterial.properties().metallic() );
2198 if ( PreviewTextureButton(
id, texture, !fromTexture ) )
2208 tempField.
_name =
"Roughness";
2211 tempField.
_readOnly = fromTexture || readOnly;
2214 tempField.
_tooltip =
"Control managed by application (e.g. is overriden by a texture)";
2216 tempField.
_data = &roughness;
2217 tempField.
_range = { 0.0f, 1.0f };
2218 tempField.
_dataSetter = [material](
const void* r )
2220 material->properties().roughness( *
static_cast<const F32*
>(r) );
2222 ImGui::PushItemWidth( 175 );
2224 ImGui::PopItemWidth();
2226 ApplyAllButton(
id, fromTexture || readOnly, *material, [](
const Material& baseMaterial,
Material* matInstance )
2228 matInstance->properties().roughness( baseMaterial.properties().roughness() );
2230 if ( PreviewTextureButton(
id, texture, !fromTexture ) )
2241 tempField.
_name =
"Occlusion";
2244 tempField.
_readOnly = fromTexture || readOnly;
2247 tempField.
_tooltip =
"Control managed by application (e.g. is overriden by a texture)";
2249 tempField.
_data = &occlusion;
2250 tempField.
_range = { 0.0f, 1.0f };
2251 tempField.
_dataSetter = [material](
const void* m )
2253 material->properties().occlusion( *
static_cast<const F32*
>(m) );
2256 ImGui::PushItemWidth( 175 );
2258 ImGui::PopItemWidth();
2261 ApplyAllButton(
id, fromTexture || readOnly, *material, [](
const Material& baseMaterial,
Material* matInstance )
2263 matInstance->properties().occlusion( baseMaterial.properties().occlusion() );
2265 if ( PreviewTextureButton(
id, texture, !fromTexture ) )
2274 F32 parallax = material->properties().parallaxFactor();
2276 tempField.
_name =
"Parallax";
2280 tempField.
_data = ¶llax;
2281 tempField.
_range = { 0.0f, 1.0f };
2282 tempField.
_dataSetter = [material](
const void* p )
2284 material->properties().parallaxFactor( *
static_cast<const F32*
>(p) );
2286 ImGui::PushItemWidth( 175 );
2288 ImGui::PopItemWidth();
2290 ApplyAllButton(
id, fromTexture || readOnly, *material, [](
const Material& baseMaterial,
Material* matInstance )
2292 matInstance->properties().parallaxFactor( baseMaterial.properties().parallaxFactor() );
2297 constexpr const char*
const names[] = {
2298 "Tex operation [Albedo - Tex0]",
2299 "Tex operation [(Albedo*Tex0) - Tex1]",
2300 "Tex operation [SpecColour - SpecMap]"
2304 for (
U8 i = 0; i < 3; ++i )
2310 const bool hasTexture = material->
getTexture( targetTex ) != INVALID_HANDLE<Texture>;
2312 ImGui::PushID( 4321234 +
id++ );
2318 ImGui::Text( names[i] );
2324 const bool isSelected = op == crtOp;
2342 ImGui::SetItemDefaultFocus();
2347 ApplyAllButton(
id, fromTexture || readOnly, *material, [targetTex](
const Material& baseMaterial,
Material* matInstance )
2354 if ( ImGui::IsItemHovered() )
2356 ImGui::SetTooltip(
"Insuficient input textures for this operation!" );
2357 skipAutoTooltip(
true );
2365 bool ignoreTexAlpha = material->properties().overrides().ignoreTexDiffuseAlpha();
2366 bool doubleSided = material->properties().doubleSided();
2367 bool refractive = material->properties().
isRefractive();
2369 ImGui::Text(
"[Double Sided]" ); ImGui::SameLine();
2374 material->properties().doubleSided( oldVal );
2376 material->properties().doubleSided( doubleSided );
2379 ApplyAllButton(
id, fromTexture || readOnly, *material, [](
const Material& baseMaterial,
Material* matInstance )
2381 matInstance->properties().doubleSided( baseMaterial.properties().doubleSided() );
2383 ImGui::Text(
"[Ignore texture Alpha]" ); ImGui::SameLine();
2386 RegisterUndo<bool, false>(
_parent,
PushConstantType::BOOL, !ignoreTexAlpha, ignoreTexAlpha,
"IgnoretextureAlpha", [material](
const bool& oldVal )
2388 material->properties().ignoreTexDiffuseAlpha( oldVal );
2390 material->properties().ignoreTexDiffuseAlpha( ignoreTexAlpha );
2393 ApplyAllButton(
id, fromTexture || readOnly, *material, [](
const Material& baseMaterial,
Material* matInstance )
2395 matInstance->properties().ignoreTexDiffuseAlpha( baseMaterial.properties().overrides().ignoreTexDiffuseAlpha() );
2397 ImGui::Text(
"[Refractive]" ); ImGui::SameLine();
2402 material->properties().isRefractive( oldVal );
2407 ApplyAllButton(
id, fromTexture || readOnly, *material, [](
const Material& baseMaterial,
Material* matInstance )
2409 matInstance->properties().isRefractive( baseMaterial.properties().
isRefractive() );
2432 ImGui::PushID(
name );
2446 ImFont* boldFont = ImGui::GetIO().Fonts->Fonts[1];
2449 bool val = field.
get<
bool>();
2456 ret = ImGui::Checkbox(
"", &val );
2459 ImGui::PushFont( boldFont );
2460 ImGui::Text(
name );
2462 if ( ImGui::IsItemHovered( ImGuiHoveredFlags_AllowWhenDisabled ) )
2470 ImGui::SetTooltip(
name );
2472 skipAutoTooltip(
true );
2479 field.
set( oldVal );
2481 field.
set<
bool>( val );
2512 ret = Util::inputOrSlider<D64, D64, 1>(
_parent, isSlider,
name, step, ImGuiDataType_Double, field, flags, field.
_format );
2516 ret = Util::inputOrSlider<F32, F32, 1>(
_parent, isSlider,
name, step, ImGuiDataType_Float, field, flags, field.
_format );
2586 ret = Util::inputOrSlider<vec2<F32>,
F32, 2>(
_parent, isSlider,
name, step, ImGuiDataType_Float, field, flags, field.
_format );
2590 ret = Util::inputOrSlider<vec3<F32>,
F32, 3>(
_parent, isSlider,
name, step, ImGuiDataType_Float, field, flags, field.
_format );
2594 ret = Util::inputOrSlider<vec4<F32>,
F32, 4>(
_parent, isSlider,
name, step, ImGuiDataType_Float, field, flags, field.
_format );
2598 ret = Util::inputOrSlider<vec2<D64>,
D64, 2>(
_parent, isSlider,
name, step, ImGuiDataType_Double, field, flags, field.
_format );
2602 ret = Util::inputOrSlider<vec3<D64>,
D64, 3>(
_parent, isSlider,
name, step, ImGuiDataType_Double, field, flags, field.
_format );
2606 ret = Util::inputOrSlider<vec4<D64>,
D64, 4>(
_parent, isSlider,
name, step, ImGuiDataType_Double, field, flags, field.
_format );
2678 ret = Util::inputMatrix<mat2<F32>, 2>(
_parent,
name, step, ImGuiDataType_Float, field, flags, field.
_format );
2682 ret = Util::inputMatrix<mat3<F32>, 3>(
_parent,
name, step, ImGuiDataType_Float, field, flags, field.
_format );
2686 ret = Util::inputMatrix<mat4<F32>, 4>(
_parent,
name, step, ImGuiDataType_Float, field, flags, field.
_format );
2690 ret = Util::inputMatrix<mat2<D64>, 2>(
_parent,
name, step, ImGuiDataType_Double, field, flags, field.
_format );
2694 ret = Util::inputMatrix<mat3<D64>, 3>(
_parent,
name, step, ImGuiDataType_Double, field, flags, field.
_format );
2698 ret = Util::inputMatrix<mat4<D64>, 4>(
_parent,
name, step, ImGuiDataType_Double, field, flags, field.
_format );
2710 ImGui::Text(
name );
#define PROFILE_SCOPE_AUTO(CATEGORY)
static F32 * max(BoundingBox &bb) noexcept
static F32 * min(BoundingBox &bb) noexcept
static F32 & radius(BoundingSphere &bs) noexcept
static F32 * center(BoundingSphere &bs) noexcept
static void onChanged(const EditorComponent &comp, const EditorComponentField &field)
static vector< EditorComponentField > & fields(EditorComponent &comp) noexcept
static void saveNode(const Editor &editor, const SceneGraphNode *targetNode)
static Camera * getSelectedCamera(const Editor &editor) noexcept
static void lockSolutionExplorer(Editor &editor, const bool state) noexcept
static vector< EditorComponent * > & editorComponents(SceneGraphNode *node) noexcept
void setMin(const vec3< F32 > &min) noexcept
vec3< F32 > getCenter() const noexcept
void setMax(const vec3< F32 > &max) noexcept
vec3< F32 > getHalfExtent() const noexcept
void setRadius(F32 radius) noexcept
void setCenter(const vec3< F32 > ¢er) noexcept
const mat4< F32 > & projectionMatrix() const noexcept
Returns the most recent/up-to-date projection matrix.
const mat4< F32 > & setProjection(vec2< F32 > zPlanes)
const mat4< F32 > & viewMatrix() const noexcept
Returns the most recent/up-to-date view matrix.
const Frustum & getFrustum() const noexcept
Returns the most recent/up-to-date frustum.
Angle::DEGREES< F32 > getHorizontalFoV() const noexcept
Returns the horizontal field of view, calculated from the vertical FoV and aspect ratio.
const CameraSnapshot & snapshot() const noexcept
Returns the internal camera snapshot data (eye, orientation, etc)
void setAspectRatio(F32 ratio) noexcept
static constexpr F32 MAX_CAMERA_MOVE_SPEED
void setHorizontalFoV(Angle::DEGREES< F32 > horizontalFoV) noexcept
void setEuler(const vec3< Angle::DEGREES< F32 > > &euler) noexcept
Set the camera's rotation to match the specified euler angles.
void setEye(const F32 x, const F32 y, const F32 z) noexcept
Sets the camera's eye position.
static constexpr F32 MAX_CAMERA_TURN_SPEED
const Descriptor & descriptor() const noexcept
const char * getIconForNode(const SceneGraphNode *sgn) noexcept
virtual string name() const
vector< EditorComponentField > & fields() noexcept
void registerUndoEntry(const UndoEntry< T > &entry)
void debugDrawFrustum(const I64 ID, IM::FrustumDescriptor descriptor) noexcept
FORCE_INLINE I64 getGUID() const noexcept
A light object placed in the scene at a certain position.
const LightType & getLightType() const noexcept
Get the light type. (see LightType enum)
U16 getShadowArrayOffset() const noexcept
void setRenderStateBlock(const RenderStateBlock &renderStateBlock, RenderStage stage, RenderPassType pass, RenderStagePass::VariantType variant=RenderStagePass::VariantType::COUNT)
FColour4 getBaseColour(bool &hasTextureOverride, Handle< Texture > &textureOut) const noexcept
Handle< ShaderProgram > computeAndGetProgramHandle(RenderStagePass renderStagePass)
Handle< Texture > getTexture(TextureSlot textureUsage) const
static constexpr F32 MAX_SHININESS
F32 getRoughness(bool &hasTextureOverride, Handle< Texture > &textureOut) const noexcept
const TextureInfo & getTextureInfo(TextureSlot usage) const
F32 getMetallic(bool &hasTextureOverride, Handle< Texture > &textureOut) const noexcept
FColour3 getEmissive(bool &hasTextureOverride, Handle< Texture > &textureOut) const noexcept
FColour3 getAmbient(bool &hasTextureOverride, Handle< Texture > &textureOut) const noexcept
void lockInstancesForRead() const noexcept
void setTextureOperation(TextureSlot textureUsageSlot, TextureOperation op)
const RenderStateBlock & getOrCreateRenderStateBlock(RenderStagePass renderStagePass)
bool isRefractive() const noexcept
FColour3 getSpecular(bool &hasTextureOverride, Handle< Texture > &textureOut) const noexcept
const vector< Handle< Material > > & getInstancesLocked() const noexcept
F32 getOcclusion(bool &hasTextureOverride, Handle< Texture > &textureOut) const noexcept
void unlockInstancesForRead() const noexcept
std::array< vec3< F32 >, 3 > OBBAxis
PlatformContext & context() noexcept
PlatformContext & _context
Kernel & kernel() noexcept
Editor & editor() noexcept
GFXDevice & gfx() noexcept
bool processField(EditorComponentField &field)
void drawInternal() override
void backgroundUpdateInternal() override
Handle< Texture > _previewTexture
const Selections & selections() const
bool processBasicField(EditorComponentField &field)
bool printComponent(SceneGraphNode *sgnNode, EditorComponent *comp, F32 xOffset, F32 smallButtonWidth)
bool processMaterial(Material *material, bool readOnly, bool hex)
string name() const override
SceneGraphNode * node(I64 guid) const
PropertyWindow(Editor &parent, PlatformContext &context, const Descriptor &descriptor)
bool processTransform(TransformComponent *transform, bool readOnly, bool hex)
bool drawCamera(Camera *cam)
struct Divide::PropertyWindow::LockedComponent _lockedComponent
void onRemoveComponent(const EditorComponent &comp) override
vec3< Angle::RADIANS< T > > getEuler() const noexcept
void clearFlag(Flags flag, bool recursive=true)
Clearing a flag might propagate to child nodes (e.g. selection).
void setFlag(Flags flag, bool recursive=true)
General purpose flag management. Certain flags propagate to children (e.g. selection)!
FORCE_INLINE T * get() const
Returns a pointer to a specific component. Returns null if the SGN does not have the component reques...
bool hasFlag(const Flags flag) const noexcept
Returns true only if the current node has the specified flag. Does not check children!
const Selections & getCurrentSelection(const PlayerIndex index=0) const
const ShaderProgramDescriptor & descriptor() const noexcept
static vector< Camera * > & shadowCameras(const ShadowType type) noexcept
vec3< T > getForwardDirection() const noexcept
Returns normalized(getForwardVec())
constexpr DEGREES< T > to_DEGREES(RADIANS< T > angle) noexcept
constexpr Optick::Category::Type GUI
const char * StencilOperationToString(StencilOperation op) noexcept
const char * RenderPassTypeToString(const RenderPassType pass) noexcept
const char * CameraModeToString(const Camera::Mode mode) noexcept
const char * CullModeToString(CullMode mode) noexcept
const char * ComparisonFunctionToString(ComparisonFunction func) noexcept
const char * FillModeToString(FillMode mode) noexcept
const char * ShadingModeToString(ShadingMode shadingMode) noexcept
const char * ComponentTypeToString(const ComponentType compType) noexcept
const char * TextureOperationToString(TextureOperation textureOp) noexcept
const char * RenderStageToString(const RenderStage stage) noexcept
Str StringFormat(const char *fmt, Args &&...args)
string to_string(GET_PASS_TYPE< T > value)
const char * PushedToolTip()
void PushTooltip(const char *tooltip)
void PushNarrowLabelWidth()
void PopNarrowLabelWidth()
void OpenCenteredPopup(const char *name, ImGui::ImGuiPopupFlags popup_flags=0)
UColour4 ToByteColour(const FColour4 &floatColour) noexcept
bool colourInput4(Editor &parent, EditorComponentField &field)
ImGuiInputTextFlags GetDefaultFlagsForField(const EditorComponentField &field)
bool colourInput3(Editor &parent, EditorComponentField &field)
constexpr const char * FieldLabels[]
std::array< U64, 1024 > s_openProperties
void ApplyToMaterials(const Material &baseMaterial, Material *instanceRoot, Pred &&predicate)
hashMap< U64, std::tuple< Frustum, FColour3, bool > > g_debugFrustums
bool IsRequiredComponentType(SceneGraphNode *selection, const ComponentType componentType)
void ApplyAllButton(I32 &id, const bool readOnly, const Material &material, Pred &&predicate)
Handle console commands that start with a forward slash.
FileError openFile(const std::string_view cmd, const ResourcePath &filePath, const std::string_view fileName)
constexpr U32 to_U32(const T value)
void PushReadOnly(const bool fade)
StencilOperation
Valid front and back stencil test actions.
@ COUNT
Place all properties above this.
size_t GetHash(const PropertyDescriptor< T > &descriptor) noexcept
DirectionalLightComponent(SceneGraphNode *sgn, PlatformContext &context)
constexpr F32 EPSILON_F32
TextureOperation
How should each texture be added.
eastl::vector< Type > vector
hashAlg::unordered_map< K, V, HashFun, Predicate > hashMap
@ COUNT
Place all properties above this.
constexpr U64 _ID(const char *const str, const U64 value=val_64_const) noexcept
FillMode
Defines all available fill modes for primitives.
@ COUNT
Place all properties above this.
constexpr U8 to_U8(const T value)
constexpr I32 to_I32(const T value)
CullMode
Specifies whether front- or back-facing facets are candidates for culling.
@ COUNT
Place all properties above this.
FORCE_INLINE T * Get(const Handle< T > handle)
@ DROPDOWN_TYPE
Only U8 types supported!
constexpr auto to_base(const Type value) -> Type
bool ToggleButton(const char *str_id, bool *v)
Angle::DEGREES< F32 > _fov
void set(const T &dataIn)
DELEGATE_STD< void, const void * > _dataSetter
vec2< F32 > _range
Used by slider_type as a min / max range or dropdown as selected_index / count.
F32 _step
0.0f == no +- buttons
PushConstantType _basicType
bool isMatrix() const noexcept
PushConstantSize _basicTypeSize
const char *const * _labels
EditorComponentFieldType _type
const char * getDisplayName(const U8 index) const
TextureOperation _operation
SceneGraphNode * _parentSGN
EditorComponent * _editorComp
StringReturnType< N > string() const noexcept
bool empty() const noexcept
std::array< I64, MAX_SELECTIONS > _selections
DELEGATE_STD< void, const T & > _dataSetter