Skip to content

Commit

Permalink
Add shadow resolution in rendering 'Quality" options
Browse files Browse the repository at this point in the history
+ add support for signed enum types and remove signed enum flag property types.
  • Loading branch information
Benualdo committed Dec 28, 2024
1 parent 83a532d commit a85abc3
Show file tree
Hide file tree
Showing 18 changed files with 259 additions and 114 deletions.
14 changes: 13 additions & 1 deletion Renderer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@
<Property type="Bool" name="m_toolMode" value="false"/>
<Property type="EnumU32" name="m_debugDisplayMode" value="None"/>
<Property type="Bool" name="m_useCustomQualityLevel" value="false"/>
<Property type="EnumU8" name="m_customQualityLevel" value="High"/>
<Property type="EnumI8" name="m_customQualityLevel" value="VeryLow"/>
<Property type="EnumU8" name="m_lightingMode" value="Deferred"/>
<Property type="EnumFlagsU32" name="m_pbrFlags" value="GenerateIrradianceCubemap|GenerateSpecularReflectionCubemap|GenerateSpecularBRDF"/>
<Property type="Bool" name="m_shadows[Quality::VeryLow]" value="false"/>
<Property type="Bool" name="m_shadows[Quality::Low]" value="true"/>
<Property type="Bool" name="m_shadows[Quality::Medium]" value="true"/>
<Property type="Bool" name="m_shadows[Quality::High]" value="true"/>
<Property type="Bool" name="m_shadows[Quality::VeryHigh]" value="true"/>
<Property type="EnumU16" name="m_shadowsResolution[Quality::VeryLow]" value="ShadowDefaultResolution_512"/>
<Property type="EnumU16" name="m_shadowsResolution[Quality::Low]" value="ShadowDefaultResolution_1024"/>
<Property type="EnumU16" name="m_shadowsResolution[Quality::Medium]" value="ShadowDefaultResolution_2048"/>
<Property type="EnumU16" name="m_shadowsResolution[Quality::High]" value="ShadowDefaultResolution_4096"/>
<Property type="EnumU16" name="m_shadowsResolution[Quality::VeryHigh]" value="ShadowDefaultResolution_4096"/>
<Property type="Float4" name="m_defaultEnvironmentColor" x="0.1" y="0.1" z="0.1" w="1"/>
<Property type="Bool" name="m_useDefaultEnvironmentCubemap" value="true"/>
<Property type="ResourcePtr" name="m_defaultEnvironmentCubemap">
Expand All @@ -24,9 +34,11 @@
<Property type="Float" name="m_defaultIrradianceIntensity" value="1"/>
<Property type="Float" name="m_defaultSpecularReflectionIntensity" value="1"/>
<Property type="EnumU8" name="m_HDRmode" value="None"/>
<Property type="EnumU8" name="m_msaa[Quality::VeryLow]" value="None"/>
<Property type="EnumU8" name="m_msaa[Quality::Low]" value="None"/>
<Property type="EnumU8" name="m_msaa[Quality::Medium]" value="None"/>
<Property type="EnumU8" name="m_msaa[Quality::High]" value="MSAA4X"/>
<Property type="EnumU8" name="m_msaa[Quality::VeryHigh]" value="None"/>
<Property type="EnumU8" name="m_VSync" value="VSync_1"/>
<Property type="Bool" name="m_rayTracing" value="false"/>
<Property type="Bool" name="m_postProcess" value="true"/>
Expand Down
2 changes: 1 addition & 1 deletion data/Scenes/Aiguelongue.scene
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@
<Property type="Float2" name="m_shadowRange" x="0.1" y="100"/>
<Property type="Float" name="m_shadowBias" value="0.1"/>
<Property type="Uint2" name="m_shadowSize" x="50" y="50"/>
<Property type="Uint2" name="m_shadowResolution" x="4096" y="4096"/>
<Property type="EnumI8" name="m_shadowResolution" value="ShadowResolution_High"/>
<Property type="Float" name="m_shadowIntensity" value="1"/>
<Property type="Bool" name="m_shadowCameraOffset" value="true"/>
<Property type="Float4" name="m_color" x="1" y="1" z="1" w="1"/>
Expand Down
9 changes: 6 additions & 3 deletions data/Scenes/PBR.scene
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@
<Property type="ObjectPtr" name="m_cameraSettings">
<Object class="CameraSettings">
<Property type="String" name="m_name" value="CameraSettings #2"/>
<Property type="Uint32" name="m_uid" value="0"/>
<Property type="Uint32" name="m_uid" value="2307130617"/>
<Property type="Uint32" name="m_originalUID" value="0"/>
<Property type="EnumFlagsU32" name="m_objectFlags" value=""/>
<Property type="Float" name="m_near" value="0.1"/>
<Property type="Float" name="m_far" value="1000"/>
<Property type="ResourcePtr" name="m_lensRes">
<Object class="LensResource">
<Property type="String" name="m_name" value="LensResource #2"/>
<Property type="Uint32" name="m_uid" value="0"/>
<Property type="Uint32" name="m_uid" value="2811179971"/>
<Property type="Uint32" name="m_originalUID" value="0"/>
<Property type="EnumFlagsU32" name="m_objectFlags" value=""/>
<Property type="String" name="m_resourcePath" value=""/>
Expand All @@ -59,6 +59,8 @@
<Property type="Float" name="m_focusDistance" value="3"/>
<Property type="Float" name="m_aperture" value="4"/>
<Property type="EnumU8" name="m_gateFitMode" value="Vertical"/>
<Property type="Bool" name="m_depthOfField" value="false"/>
<Property type="Bool" name="m_motionBlur" value="false"/>
</Object>
</Property>
</Object>
Expand Down Expand Up @@ -124,8 +126,9 @@
<Property type="Float2" name="m_shadowRange" x="0.1" y="100"/>
<Property type="Float" name="m_shadowBias" value="0.050000001"/>
<Property type="Uint2" name="m_shadowSize" x="16" y="16"/>
<Property type="Uint2" name="m_shadowResolution" x="2048" y="2048"/>
<Property type="EnumI8" name="m_shadowResolution" value="ShadowResolution_High"/>
<Property type="Float" name="m_shadowIntensity" value="1"/>
<Property type="Bool" name="m_shadowCameraOffset" value="false"/>
<Property type="Float4" name="m_color" x="1" y="1" z="1" w="1"/>
<Property type="Float" name="m_intensity" value="1"/>
</Object>
Expand Down
8 changes: 2 additions & 6 deletions src/core/IProperty.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ namespace vg::core
EnumFlagsU16,
EnumFlagsU32,
EnumFlagsU64,
EnumFlagsI8,
EnumFlagsI16,
EnumFlagsI32,
EnumFlagsI64,
BitMask,
Resource,
ResourcePtr,
Expand Down Expand Up @@ -127,8 +123,8 @@ namespace vg::core
virtual void SetDescription (const char * _description) = 0;
virtual void SetEnumTypeName (const char * _enumTypeName) = 0;
virtual bool SetEnumValueFlags (u64 _value, EnumValueFlags _flags, bool _enabled) = 0;
virtual EnumValueFlags GetEnumValueFlags (u64 _value) const = 0;

virtual EnumValueFlags GetUnsignedEnumValueFlags (u64 _value) const = 0;
virtual EnumValueFlags GetSignedEnumValueFlags (i64 _value) const = 0;
virtual const char * GetInterface () const = 0;
virtual const char * GetName () const = 0;
virtual const char * GetClassName () const = 0;
Expand Down
8 changes: 4 additions & 4 deletions src/core/Object/ClassDesc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ namespace vg::core
void ClassDesc::RegisterEnum(const char * _className, const char * _propertyName, const char * _enumTypeName, core::i8 * _offset, const char * _displayName, uint _enumCount, const char * _enumNames, const i8 * _enumValues, PropertyFlags _flags)
{
const bool bitfield = asBool(PropertyFlags::Bitfield & _flags);
pushProperty({ _className, _propertyName, bitfield ? PropertyType::EnumFlagsI8 : PropertyType::EnumI8, (uint_ptr)_offset, (u32)sizeof(i8), _displayName, _flags, _enumCount, _enumNames, _enumValues });
pushProperty({ _className, _propertyName, PropertyType::EnumI8, (uint_ptr)_offset, (u32)sizeof(i8), _displayName, _flags, _enumCount, _enumNames, _enumValues });
auto & prop = properties.back();
prop.SetEnumTypeName(_enumTypeName);
}
Expand All @@ -336,7 +336,7 @@ namespace vg::core
void ClassDesc::RegisterEnum(const char * _className, const char * _propertyName, const char * _enumTypeName, core::i16 * _offset, const char * _displayName, uint _enumCount, const char * _enumNames, const i16 * _enumValues, PropertyFlags _flags)
{
const bool bitfield = asBool(PropertyFlags::Bitfield & _flags);
pushProperty({ _className, _propertyName, bitfield ? PropertyType::EnumFlagsI16 : PropertyType::EnumI16, (uint_ptr)_offset, (u32)sizeof(i16), _displayName, _flags, _enumCount, _enumNames, _enumValues });
pushProperty({ _className, _propertyName, PropertyType::EnumI16, (uint_ptr)_offset, (u32)sizeof(i16), _displayName, _flags, _enumCount, _enumNames, _enumValues });
auto & prop = properties.back();
prop.SetEnumTypeName(_enumTypeName);
}
Expand All @@ -345,7 +345,7 @@ namespace vg::core
void ClassDesc::RegisterEnum(const char * _className, const char * _propertyName, const char * _enumTypeName, core::i32 * _offset, const char * _displayName, uint _enumCount, const char * _enumNames, const i32 * _enumValues, PropertyFlags _flags)
{
const bool bitfield = asBool(PropertyFlags::Bitfield & _flags);
pushProperty({ _className, _propertyName, bitfield ? PropertyType::EnumFlagsI32 : PropertyType::EnumI32, (uint_ptr)_offset, (u32)sizeof(i32), _displayName, _flags, _enumCount, _enumNames, _enumValues });
pushProperty({ _className, _propertyName, PropertyType::EnumI32, (uint_ptr)_offset, (u32)sizeof(i32), _displayName, _flags, _enumCount, _enumNames, _enumValues });
auto & prop = properties.back();
prop.SetEnumTypeName(_enumTypeName);
}
Expand All @@ -354,7 +354,7 @@ namespace vg::core
void ClassDesc::RegisterEnum(const char * _className, const char * _propertyName, const char * _enumTypeName, core::i64 * _offset, const char * _displayName, uint _enumCount, const char * _enumNames, const i64 * _enumValues, PropertyFlags _flags)
{
const bool bitfield = asBool(PropertyFlags::Bitfield & _flags);
pushProperty({ _className, _propertyName, bitfield ? PropertyType::EnumFlagsI64 : PropertyType::EnumI64, (uint_ptr)_offset, (u32)sizeof(i64), _displayName, _flags, _enumCount, _enumNames, _enumValues });
pushProperty({ _className, _propertyName, PropertyType::EnumI64, (uint_ptr)_offset, (u32)sizeof(i64), _displayName, _flags, _enumCount, _enumNames, _enumValues });
auto & prop = properties.back();
prop.SetEnumTypeName(_enumTypeName);
}
Expand Down
57 changes: 45 additions & 12 deletions src/core/Object/Factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,6 @@ namespace vg::core
case PropertyType::EnumFlagsU16:
case PropertyType::EnumFlagsU32:
case PropertyType::EnumFlagsU64:
case PropertyType::EnumFlagsI8:
case PropertyType::EnumFlagsI16:
case PropertyType::EnumFlagsI32:
case PropertyType::EnumFlagsI64:
{
const void * src = (void *)(uint_ptr(_object) + offset);

Expand Down Expand Up @@ -733,28 +729,24 @@ namespace vg::core

case PropertyType::Int8:
case PropertyType::EnumI8:
case PropertyType::EnumFlagsI8:
VG_ASSERT(!srcIsEnumArray, "EnumArray CopyProperties serialization not implemented for type '%s'", asString(srcPropType).c_str());
*_dstProp->GetPropertyInt8(_dstObj) = *_srcProp->GetPropertyInt8(_srcObj);
break;

case PropertyType::Int16:
case PropertyType::EnumI16:
case PropertyType::EnumFlagsI16:
VG_ASSERT(!srcIsEnumArray, "EnumArray CopyProperties serialization not implemented for type '%s'", asString(srcPropType).c_str());
*_dstProp->GetPropertyInt16(_dstObj) = *_srcProp->GetPropertyInt16(_srcObj);
break;

case PropertyType::Int32:
case PropertyType::EnumI32:
case PropertyType::EnumFlagsI32:
VG_ASSERT(!srcIsEnumArray, "EnumArray CopyProperties serialization not implemented for type '%s'", asString(srcPropType).c_str());
*_dstProp->GetPropertyInt32(_dstObj) = *_srcProp->GetPropertyInt32(_srcObj);
break;

case PropertyType::Int64:
case PropertyType::EnumI64:
case PropertyType::EnumFlagsI64:
VG_ASSERT(!srcIsEnumArray, "EnumArray CopyProperties serialization not implemented for type '%s'", asString(srcPropType).c_str());
*_dstProp->GetPropertyInt64(_dstObj) = *_srcProp->GetPropertyInt64(_srcObj);
break;
Expand Down Expand Up @@ -1089,10 +1081,6 @@ namespace vg::core
case PropertyType::EnumFlagsU16:
case PropertyType::EnumFlagsU32:
case PropertyType::EnumFlagsU64:
case PropertyType::EnumFlagsI8:
case PropertyType::EnumFlagsI16:
case PropertyType::EnumFlagsI32:
case PropertyType::EnumFlagsI64:
{
void * dst = (void *)(uint_ptr(_object) + offset);
if (isEnumArray)
Expand Down Expand Up @@ -2028,6 +2016,31 @@ namespace vg::core
serializeEnumPropertyFromXML<u32>(_object, prop, xmlPropElem);
break;

case PropertyType::EnumU64:
VG_ASSERT(!isEnumArray, "EnumArray serialization from XML not implemented for type '%s'", asString(type).c_str());
serializeEnumPropertyFromXML<u64>(_object, prop, xmlPropElem);
break;

case PropertyType::EnumI8:
VG_ASSERT(!isEnumArray, "EnumArray serialization from XML not implemented for type '%s'", asString(type).c_str());
serializeEnumPropertyFromXML<i8>(_object, prop, xmlPropElem);
break;

case PropertyType::EnumI16:
VG_ASSERT(!isEnumArray, "EnumArray serialization from XML not implemented for type '%s'", asString(type).c_str());
serializeEnumPropertyFromXML<i16>(_object, prop, xmlPropElem);
break;

case PropertyType::EnumI32:
VG_ASSERT(!isEnumArray, "EnumArray serialization from XML not implemented for type '%s'", asString(type).c_str());
serializeEnumPropertyFromXML<i32>(_object, prop, xmlPropElem);
break;

case PropertyType::EnumI64:
VG_ASSERT(!isEnumArray, "EnumArray serialization from XML not implemented for type '%s'", asString(type).c_str());
serializeEnumPropertyFromXML<i64>(_object, prop, xmlPropElem);
break;

case PropertyType::Uint8:
if (isEnumArray)
{
Expand Down Expand Up @@ -2622,6 +2635,26 @@ namespace vg::core
VG_ASSERT(!isEnumArray, "EnumArray serialization to XML not implemented for type '%s'", asString(type).c_str());
serializeEnumPropertyToXML<u64>(_object, prop, xmlPropElem);
break;

case PropertyType::EnumI8:
VG_ASSERT(!isEnumArray, "EnumArray serialization to XML not implemented for type '%s'", asString(type).c_str());
serializeEnumPropertyToXML<i8>(_object, prop, xmlPropElem);
break;

case PropertyType::EnumI16:
VG_ASSERT(!isEnumArray, "EnumArray serialization to XML not implemented for type '%s'", asString(type).c_str());
serializeEnumPropertyToXML<i16>(_object, prop, xmlPropElem);
break;

case PropertyType::EnumI32:
VG_ASSERT(!isEnumArray, "EnumArray serialization to XML not implemented for type '%s'", asString(type).c_str());
serializeEnumPropertyToXML<i32>(_object, prop, xmlPropElem);
break;

case PropertyType::EnumI64:
VG_ASSERT(!isEnumArray, "EnumArray serialization to XML not implemented for type '%s'", asString(type).c_str());
serializeEnumPropertyToXML<i64>(_object, prop, xmlPropElem);
break;
}

if (!skipAttribute)
Expand Down
4 changes: 0 additions & 4 deletions src/core/Object/Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,25 +272,21 @@ namespace vg::core

case PropertyType::Int8:
case PropertyType::EnumI8:
case PropertyType::EnumFlagsI8:
*(i8 *)_previousValue = *(i8 *)_newValue;
break;

case PropertyType::Int16:
case PropertyType::EnumI16:
case PropertyType::EnumFlagsI16:
*(i16 *)_previousValue = *(i16 *)_newValue;
break;

case PropertyType::Int32:
case PropertyType::EnumI32:
case PropertyType::EnumFlagsI32:
*(i32 *)_previousValue = *(i32 *)_newValue;
break;

case PropertyType::Int64:
case PropertyType::EnumI64:
case PropertyType::EnumFlagsI64:
*(i64 *)_previousValue = *(i64 *)_newValue;
break;

Expand Down
4 changes: 2 additions & 2 deletions src/core/Object/Property.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ namespace vg::core
void SetDescription (const char * _description) final override;
void SetEnumTypeName (const char * _enumTypeName) final override;
bool SetEnumValueFlags (u64 _value, EnumValueFlags _flags, bool _enabled) final override;
EnumValueFlags GetEnumValueFlags (u64 _value) const final override;

EnumValueFlags GetUnsignedEnumValueFlags (u64 _value) const final override;
EnumValueFlags GetSignedEnumValueFlags (i64 _value) const final override;
const char * GetInterface () const final override;
const char * GetName () const final override;
const char * GetClassName () const final override;
Expand Down
Loading

0 comments on commit a85abc3

Please sign in to comment.