mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-27 18:43:48 +00:00
Implementation of sRGB image support. Overhauls the linearization setup to utilize the sRGB image types, as well as refactors the use of ColorF and ColorI to be properly internally consistent. ColorIs are used only for front-facing/editing/UI settings, and ColorFs, now renamed to LinearColorF to reduce confusion of purpose, are used for color info in the engine itself. This avoids confusing and expensive conversions back and forth between types and avoids botches with linearity. Majority work done by @rextimmy
This commit is contained in:
parent
8780f83262
commit
25686ed4be
294 changed files with 3894 additions and 2813 deletions
|
|
@ -1190,8 +1190,8 @@ bool Taml::generateTamlSchema()
|
|||
pColorEnumsRestrictionElement->LinkEndChild( pColorEnumsAttributeEnumerationElement );
|
||||
}
|
||||
|
||||
// ColorF.
|
||||
TiXmlComment* pColorFValuesComment = new TiXmlComment( "ColorF Values" );
|
||||
// LinearColorF.
|
||||
TiXmlComment* pColorFValuesComment = new TiXmlComment( "LinearColorF Values" );
|
||||
pSchemaElement->LinkEndChild( pColorFValuesComment );
|
||||
TiXmlElement* pColorFValuesTypeElement = new TiXmlElement( "xs:simpleType" );
|
||||
pColorFValuesTypeElement->SetAttribute( "name", "ColorF_Values" );
|
||||
|
|
@ -1203,7 +1203,7 @@ bool Taml::generateTamlSchema()
|
|||
pColorFValuesElementB->SetAttribute( "value", "([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b" );
|
||||
pColorFValuesElementA->LinkEndChild( pColorFValuesElementB );
|
||||
|
||||
TiXmlComment* pColorFComment = new TiXmlComment( "ColorF Console Type" );
|
||||
TiXmlComment* pColorFComment = new TiXmlComment( "LinearColorF Console Type" );
|
||||
pSchemaElement->LinkEndChild( pColorFComment );
|
||||
TiXmlElement* pColorFTypeElement = new TiXmlElement( "xs:simpleType" );
|
||||
pColorFTypeElement->SetAttribute( "name", "ColorF_ConsoleType" );
|
||||
|
|
|
|||
|
|
@ -112,16 +112,16 @@ public:
|
|||
set( pFieldName, pFieldValue );
|
||||
}
|
||||
|
||||
inline void setFieldValue( const char* pFieldName, const ColorF& fieldValue )
|
||||
inline void setFieldValue( const char* pFieldName, const LinearColorF& fieldValue )
|
||||
{
|
||||
// Fetch the field value.
|
||||
const char* pFieldValue = Con::getData( TypeColorF, &const_cast<ColorF&>(fieldValue), 0 );
|
||||
const char* pFieldValue = Con::getData( TypeColorF, &const_cast<LinearColorF&>(fieldValue), 0 );
|
||||
|
||||
// Did we get a field value?
|
||||
if ( pFieldValue == NULL )
|
||||
{
|
||||
// No, so warn.
|
||||
Con::warnf( "Taml: Failed to add node field name '%s' with ColorF value.", pFieldName );
|
||||
Con::warnf( "Taml: Failed to add node field name '%s' with LinearColorF value.", pFieldName );
|
||||
pFieldValue = StringTable->EmptyString();
|
||||
}
|
||||
|
||||
|
|
@ -211,7 +211,7 @@ public:
|
|||
set( pFieldName, fieldValue );
|
||||
}
|
||||
|
||||
inline void getFieldValue( ColorF& fieldValue ) const
|
||||
inline void getFieldValue( LinearColorF& fieldValue ) const
|
||||
{
|
||||
fieldValue.set( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
|
||||
|
|
@ -476,7 +476,7 @@ public:
|
|||
return registerField( pNodeField );
|
||||
}
|
||||
|
||||
inline TamlCustomField* addField( const char* pFieldName, const ColorF& fieldValue )
|
||||
inline TamlCustomField* addField( const char* pFieldName, const LinearColorF& fieldValue )
|
||||
{
|
||||
TamlCustomField* pNodeField = TamlCustomFieldFactory.createObject();
|
||||
pNodeField->setFieldValue( pFieldName, fieldValue );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue