diff --git a/Source/Engine/Graphics/Models/ModelData.Tool.cpp b/Source/Engine/Graphics/Models/ModelData.Tool.cpp index d061d0745..727fe7754 100644 --- a/Source/Engine/Graphics/Models/ModelData.Tool.cpp +++ b/Source/Engine/Graphics/Models/ModelData.Tool.cpp @@ -318,7 +318,9 @@ void MeshData::BuildIndexBuffer() } const auto endTime = Platform::GetTimeSeconds(); - LOG(Info, "Generated index buffer for mesh in {0}s ({1} vertices, {2} indices)", Utilities::RoundTo2DecimalPlaces(endTime - startTime), Positions.Count(), Indices.Count()); + const double time = Utilities::RoundTo2DecimalPlaces(endTime - startTime); + if (time > 0.5f) // Don't log if generation was fast enough + LOG(Info, "Generated {3} for mesh in {0}s ({1} vertices, {2} indices)", time, vertexCount, Indices.Count(), TEXT("indices")); } void MeshData::FindPositions(const Float3& position, float epsilon, Array& result) @@ -449,7 +451,9 @@ bool MeshData::GenerateNormals(float smoothingAngle) } const auto endTime = Platform::GetTimeSeconds(); - LOG(Info, "Generated tangents for mesh in {0}s ({1} vertices, {2} indices)", Utilities::RoundTo2DecimalPlaces(endTime - startTime), vertexCount, indexCount); + const double time = Utilities::RoundTo2DecimalPlaces(endTime - startTime); + if (time > 0.5f) // Don't log if generation was fast enough + LOG(Info, "Generated {3} for mesh in {0}s ({1} vertices, {2} indices)", time, vertexCount, indexCount, TEXT("normals")); return false; } @@ -685,7 +689,10 @@ bool MeshData::GenerateTangents(float smoothingAngle) #endif const auto endTime = Platform::GetTimeSeconds(); - LOG(Info, "Generated tangents for mesh in {0}s ({1} vertices, {2} indices)", Utilities::RoundTo2DecimalPlaces(endTime - startTime), vertexCount, indexCount); + const double time = Utilities::RoundTo2DecimalPlaces(endTime - startTime); + if (time > 0.5f) // Don't log if generation was fast enough + LOG(Info, "Generated {3} for mesh in {0}s ({1} vertices, {2} indices)", time, vertexCount, indexCount, TEXT("tangents")); + return false; } @@ -872,7 +879,9 @@ void MeshData::ImproveCacheLocality() Allocator::Free(piCandidates); const auto endTime = Platform::GetTimeSeconds(); - LOG(Info, "Cache relevant optimize for {0} vertices and {1} indices. Average output ACMR is {2}. Time: {3}s", vertexCount, indexCount, (float)iCacheMisses / indexCount / 3, Utilities::RoundTo2DecimalPlaces(endTime - startTime)); + const double time = Utilities::RoundTo2DecimalPlaces(endTime - startTime); + if (time > 0.5f) // Don't log if generation was fast enough + LOG(Info, "Generated {3} for mesh in {0}s ({1} vertices, {2} indices)", time, vertexCount, indexCount, TEXT("optimized indices")); } float MeshData::CalculateTrianglesArea() const diff --git a/Source/Engine/Visject/ShaderGraphValue.cpp b/Source/Engine/Visject/ShaderGraphValue.cpp index 3390563f4..6564cde2b 100644 --- a/Source/Engine/Visject/ShaderGraphValue.cpp +++ b/Source/Engine/Visject/ShaderGraphValue.cpp @@ -138,6 +138,29 @@ bool ShaderGraphValue::IsOne() const } } +bool ShaderGraphValue::IsLiteral() const +{ + switch (Type) + { + case VariantType::Types::Bool: + case VariantType::Types::Int: + case VariantType::Types::Uint: + case VariantType::Types::Float: + if (Value.HasChars()) + { + for (int32 i = 0; i < Value.Length(); i++) + { + const Char c = Value[i]; + if (!StringUtils::IsDigit(c) && c != '.') + return false; + } + return true; + } + default: + return false; + } +} + ShaderGraphValue ShaderGraphValue::InitForZero(VariantType::Types type) { const Char* v; diff --git a/Source/Engine/Visject/ShaderGraphValue.h b/Source/Engine/Visject/ShaderGraphValue.h index 7c7e25154..439b59077 100644 --- a/Source/Engine/Visject/ShaderGraphValue.h +++ b/Source/Engine/Visject/ShaderGraphValue.h @@ -143,8 +143,7 @@ public: /// /// Returns true if value is valid. /// - /// True if is valid, otherwise false. - bool IsValid() const + FORCE_INLINE bool IsValid() const { return Type != VariantType::Types::Null; } @@ -152,8 +151,7 @@ public: /// /// Returns true if value is invalid. /// - /// True if is invalid, otherwise false. - bool IsInvalid() const + FORCE_INLINE bool IsInvalid() const { return Type == VariantType::Types::Null; } @@ -161,15 +159,18 @@ public: /// /// Checks if value contains static part with zero. /// - /// True if contains zero number. bool IsZero() const; /// /// Checks if value contains static part with one. /// - /// True if contains one number. bool IsOne() const; + /// + /// Checks if value is a compile-time constant literal (eg. int, bool or float). + /// + bool IsLiteral() const; + /// /// Clears this instance. ///