Format engine codebase with ReSharper

This commit is contained in:
Wojtek Figat
2022-06-14 19:05:04 +02:00
parent 3294624849
commit d4d27b88f0
82 changed files with 276 additions and 775 deletions

View File

@@ -17,18 +17,15 @@ API_CLASS(InBuild) class Array
{
friend Array;
public:
typedef T ItemType;
typedef typename AllocationType::template Data<T> AllocationData;
private:
int32 _count;
int32 _capacity;
AllocationData _allocation;
public:
/// <summary>
/// Initializes a new instance of the <see cref="Array"/> class.
/// </summary>
@@ -208,7 +205,6 @@ public:
}
public:
/// <summary>
/// Gets the amount of the items in the collection.
/// </summary>
@@ -334,7 +330,6 @@ public:
}
public:
FORCE_INLINE T* begin()
{
return &_allocation.Get()[0];
@@ -356,7 +351,6 @@ public:
}
public:
/// <summary>
/// Clear the collection without changing its capacity.
/// </summary>
@@ -738,7 +732,6 @@ public:
}
public:
/// <summary>
/// Performs push on stack operation (stack grows at the end of the collection).
/// </summary>
@@ -777,7 +770,6 @@ public:
}
public:
/// <summary>
/// Performs enqueue to queue operation (queue head is in the beginning of queue).
/// </summary>
@@ -800,7 +792,6 @@ public:
}
public:
/// <summary>
/// Searches for the given item within the entire collection.
/// </summary>
@@ -869,7 +860,6 @@ public:
}
public:
bool operator==(const Array& other) const
{
if (_count == other._count)
@@ -891,7 +881,6 @@ public:
}
public:
/// <summary>
/// The collection iterator.
/// </summary>
@@ -915,7 +904,6 @@ public:
}
public:
Iterator()
: _array(nullptr)
, _index(-1)
@@ -935,7 +923,6 @@ public:
}
public:
FORCE_INLINE Array* GetArray() const
{
return _array;
@@ -1008,7 +995,6 @@ public:
};
public:
/// <summary>
/// Gets iterator for beginning of the collection.
/// </summary>

View File

@@ -17,11 +17,9 @@ class IGrouping : public Array<TSource>
friend ArrayExtensions;
protected:
TKey _key;
public:
/// <summary>
/// Gets the common key.
/// </summary>
@@ -47,7 +45,6 @@ public:
class ArrayExtensions
{
public:
/// <summary>
/// Searches for the specified object using a custom query and returns the zero-based index of the first occurrence within the entire collection.
/// </summary>

View File

@@ -15,18 +15,15 @@ API_CLASS(InBuild) class BitArray
friend BitArray;
public:
typedef uint64 ItemType;
typedef typename AllocationType::template Data<ItemType> AllocationData;
private:
int32 _count;
int32 _capacity;
AllocationData _allocation;
public:
/// <summary>
/// Initializes a new instance of the <see cref="BitArray"/> class.
/// </summary>
@@ -119,7 +116,6 @@ public:
}
public:
/// <summary>
/// Gets the pointer to the bits storage data (linear allocation).
/// </summary>
@@ -216,7 +212,6 @@ public:
}
public:
/// <summary>
/// Clear the collection without changing its capacity.
/// </summary>

View File

@@ -17,7 +17,6 @@ class ChunkedArray
friend ChunkedArray;
private:
// TODO: don't use Array but small struct and don't InlinedArray or Chunk* but Chunk (less dynamic allocations)
typedef Array<T> Chunk;
@@ -25,7 +24,6 @@ private:
Array<Chunk*, InlinedAllocation<32>> _chunks;
public:
ChunkedArray()
{
}
@@ -36,7 +34,6 @@ public:
}
public:
/// <summary>
/// Gets the amount of the elements in the collection.
/// </summary>
@@ -70,7 +67,6 @@ public:
}
public:
// Gets element by index
FORCE_INLINE T& At(int32 index) const
{
@@ -93,7 +89,6 @@ public:
}
public:
/// <summary>
/// Chunked array iterator.
/// </summary>
@@ -102,7 +97,6 @@ public:
friend ChunkedArray;
private:
ChunkedArray* _collection;
int32 _chunkIndex;
int32 _index;
@@ -115,7 +109,6 @@ public:
}
public:
Iterator()
: _collection(nullptr)
, _chunkIndex(INVALID_INDEX)
@@ -131,7 +124,6 @@ public:
}
public:
FORCE_INLINE ChunkedArray* GetChunkedArray() const
{
return _collection;
@@ -143,7 +135,6 @@ public:
}
public:
bool IsEnd() const
{
ASSERT(_collection);
@@ -157,7 +148,6 @@ public:
}
public:
FORCE_INLINE T& operator*() const
{
return _collection->_chunks[_chunkIndex]->At(_index);
@@ -169,7 +159,6 @@ public:
}
public:
FORCE_INLINE bool operator==(const Iterator& v) const
{
return _collection == v._collection && _chunkIndex == v._chunkIndex && _index == v._index;
@@ -181,7 +170,6 @@ public:
}
public:
Iterator& operator++()
{
ASSERT(_collection);
@@ -280,7 +268,6 @@ public:
};
public:
/// <summary>
/// Adds the specified item to the collection.
/// </summary>
@@ -482,7 +469,6 @@ public:
}
public:
Iterator Begin() const
{
return Iterator(this, 0);

View File

@@ -39,7 +39,6 @@ template<typename T, CollectionPoolCacheUtils::ClearCallback<T> ClearCallback =
class CollectionPoolCache
{
public:
/// <summary>
/// Helper object used to access the pooled collection and return it to the pool after usage (on code scope execution end).
/// </summary>
@@ -48,7 +47,6 @@ public:
friend CollectionPoolCache;
private:
CollectionPoolCache* _pool;
ScopeCache(CollectionPoolCache* pool, T* value)
@@ -58,7 +56,6 @@ public:
}
public:
T* Value;
ScopeCache() = delete;
@@ -99,7 +96,6 @@ public:
};
private:
CriticalSection _locker;
Array<T*, InlinedAllocation<64>> _pool;
@@ -111,7 +107,6 @@ private:
}
public:
/// <summary>
/// Finalizes an instance of the <see cref="CollectionPoolCache"/> class.
/// </summary>
@@ -121,7 +116,6 @@ public:
}
public:
/// <summary>
/// Gets the collection instance from the pool. Can reuse the object from the pool or create a new one. Returns collection is always cleared and ready to use.
/// </summary>

View File

@@ -18,7 +18,6 @@ API_CLASS(InBuild) class Dictionary
{
friend Dictionary;
public:
/// <summary>
/// Describes single portion of space for the key and value pair in a hash map.
/// </summary>
@@ -106,14 +105,12 @@ public:
typedef typename AllocationType::template Data<Bucket> AllocationData;
private:
int32 _elementsCount = 0;
int32 _deletedCount = 0;
int32 _size = 0;
AllocationData _allocation;
public:
/// <summary>
/// Initializes a new instance of the <see cref="Dictionary"/> class.
/// </summary>
@@ -200,7 +197,6 @@ public:
}
public:
/// <summary>
/// Gets the amount of the elements in the collection.
/// </summary>
@@ -234,7 +230,6 @@ public:
}
public:
/// <summary>
/// The Dictionary collection iterator.
/// </summary>
@@ -359,7 +354,6 @@ public:
};
public:
/// <summary>
/// Gets element by the key (will add default ValueType element if key not found).
/// </summary>
@@ -460,7 +454,6 @@ public:
}
public:
/// <summary>
/// Clears the collection but without changing its capacity (all inserted elements: keys and values will be removed).
/// </summary>
@@ -571,7 +564,6 @@ public:
}
public:
/// <summary>
/// Add pair element to the collection.
/// </summary>
@@ -700,7 +692,6 @@ public:
}
public:
/// <summary>
/// Finds the element with given key in the collection.
/// </summary>
@@ -775,7 +766,6 @@ public:
}
public:
/// <summary>
/// Clones other collection into this.
/// </summary>
@@ -813,7 +803,6 @@ public:
}
public:
Iterator Begin() const
{
Iterator i(*this, -1);
@@ -851,7 +840,6 @@ public:
}
protected:
/// <summary>
/// The result container of the dictionary item lookup searching.
/// </summary>
@@ -898,7 +886,7 @@ protected:
if (insertPos == -1)
insertPos = bucketIndex;
}
// Occupied bucket by target key
// Occupied bucket by target key
else if (bucket.Key == key)
{
// Found key

View File

@@ -17,7 +17,6 @@ API_CLASS(InBuild) class HashSet
{
friend HashSet;
public:
/// <summary>
/// Describes single portion of space for the item in a hash map.
/// </summary>
@@ -31,7 +30,7 @@ public:
Deleted,
Occupied,
};
/// <summary>The item.</summary>
T Item;
@@ -78,18 +77,16 @@ public:
return _state != Occupied;
}
};
typedef typename AllocationType::template Data<Bucket> AllocationData;
private:
int32 _elementsCount = 0;
int32 _deletedCount = 0;
int32 _size = 0;
AllocationData _allocation;
public:
/// <summary>
/// Initializes a new instance of the <see cref="HashSet"/> class.
/// </summary>
@@ -176,7 +173,6 @@ public:
}
public:
/// <summary>
/// Gets the amount of the elements in the collection.
/// </summary>
@@ -210,7 +206,6 @@ public:
}
public:
/// <summary>
/// The hash set collection iterator.
/// </summary>
@@ -234,7 +229,6 @@ public:
}
public:
Iterator(const Iterator& i)
: _collection(i._collection)
, _index(i._index)
@@ -248,7 +242,6 @@ public:
}
public:
FORCE_INLINE bool IsEnd() const
{
return _index == _collection.Capacity();
@@ -332,7 +325,6 @@ public:
};
public:
/// <summary>
/// Removes all elements from the collection.
/// </summary>
@@ -431,7 +423,6 @@ public:
}
public:
/// <summary>
/// Add element to the collection.
/// </summary>
@@ -513,7 +504,6 @@ public:
}
public:
/// <summary>
/// Find element with given item in the collection
/// </summary>
@@ -545,7 +535,6 @@ public:
}
public:
/// <summary>
/// Clones other collection into this
/// </summary>
@@ -561,7 +550,6 @@ public:
}
public:
Iterator Begin() const
{
Iterator i(*this, -1);
@@ -599,7 +587,6 @@ public:
}
protected:
/// <summary>
/// The result container of the set item lookup searching.
/// </summary>
@@ -646,7 +633,7 @@ protected:
if (insertPos == -1)
insertPos = bucketIndex;
}
// Occupied bucket by target item
// Occupied bucket by target item
else if (bucket.Item == item)
{
// Found item

View File

@@ -13,92 +13,89 @@ template<typename T, typename AllocationType = HeapAllocation>
class RingBuffer
{
public:
typedef T ItemType;
typedef typename AllocationType::template Data<T> AllocationData;
typedef T ItemType;
typedef typename AllocationType::template Data<T> AllocationData;
private:
int32 _front = 0, _back = 0, _count = 0, _capacity = 0;
AllocationData _allocation;
int32 _front = 0, _back = 0, _count = 0, _capacity = 0;
AllocationData _allocation;
public:
~RingBuffer()
{
Memory::DestructItems(Get() + Math::Min(_front, _back), _count);
}
~RingBuffer()
{
Memory::DestructItems(Get() + Math::Min(_front, _back), _count);
}
FORCE_INLINE T* Get()
{
return _allocation.Get();
}
FORCE_INLINE T* Get()
{
return _allocation.Get();
}
FORCE_INLINE int32 Count() const
{
return _count;
}
FORCE_INLINE int32 Count() const
{
return _count;
}
FORCE_INLINE int32 Capacity() const
{
return _capacity;
}
FORCE_INLINE int32 Capacity() const
{
return _capacity;
}
void PushBack(const T& data)
{
if (_capacity == 0 || _capacity == _count)
{
const int32 capacity = _allocation.CalculateCapacityGrow(_capacity, _count + 1);
AllocationData alloc;
alloc.Allocate(capacity);
const int32 frontCount = Math::Min(_capacity - _front, _count);
Memory::MoveItems(alloc.Get(), _allocation.Get() + _front, frontCount);
Memory::DestructItems(_allocation.Get() + _front, frontCount);
const int32 backCount = _count - frontCount;
Memory::MoveItems(alloc.Get() + frontCount, _allocation.Get(), backCount);
Memory::DestructItems(_allocation.Get(), backCount);
_allocation.Swap(alloc);
_front = 0;
_back = _count;
_capacity = capacity;
}
Memory::ConstructItems(_allocation.Get() + _back, &data, 1);
_back = (_back + 1) % _capacity;
_count++;
}
void PushBack(const T& data)
{
if (_capacity == 0 || _capacity == _count)
{
const int32 capacity = _allocation.CalculateCapacityGrow(_capacity, _count + 1);
AllocationData alloc;
alloc.Allocate(capacity);
const int32 frontCount = Math::Min(_capacity - _front, _count);
Memory::MoveItems(alloc.Get(), _allocation.Get() + _front, frontCount);
Memory::DestructItems(_allocation.Get() + _front, frontCount);
const int32 backCount = _count - frontCount;
Memory::MoveItems(alloc.Get() + frontCount, _allocation.Get(), backCount);
Memory::DestructItems(_allocation.Get(), backCount);
_allocation.Swap(alloc);
_front = 0;
_back = _count;
_capacity = capacity;
}
Memory::ConstructItems(_allocation.Get() + _back, &data, 1);
_back = (_back + 1) % _capacity;
_count++;
}
FORCE_INLINE T& PeekFront()
{
return _allocation.Get()[_front];
}
FORCE_INLINE T& PeekFront()
{
return _allocation.Get()[_front];
}
FORCE_INLINE const T& PeekFront() const
{
return _allocation.Get()[_front];
}
FORCE_INLINE const T& PeekFront() const
{
return _allocation.Get()[_front];
}
FORCE_INLINE T& operator[](int32 index)
{
ASSERT(index >= 0 && index < _count);
return _allocation.Get()[(_front + index) % _capacity];
return _allocation.Get()[(_front + index) % _capacity];
}
FORCE_INLINE const T& operator[](int32 index) const
{
ASSERT(index >= 0 && index < _count);
return _allocation.Get()[(_front + index) % _capacity];
return _allocation.Get()[(_front + index) % _capacity];
}
void PopFront()
{
Memory::DestructItems(_allocation.Get() + _front, 1);
_front = (_front + 1) % _capacity;
_count--;
}
void PopFront()
{
Memory::DestructItems(_allocation.Get() + _front, 1);
_front = (_front + 1) % _capacity;
_count--;
}
void Clear()
{
Memory::DestructItems(Get() + Math::Min(_front, _back), _count);
_front = _back = _count = 0;
}
void Clear()
{
Memory::DestructItems(Get() + Math::Min(_front, _back), _count);
_front = _back = _count = 0;
}
};

View File

@@ -12,12 +12,10 @@ template<typename T, int32 Size>
class SamplesBuffer
{
protected:
int32 _count = 0;
T _data[Size];
public:
/// <summary>
/// Gets amount of elements in the collection.
/// </summary>
@@ -110,7 +108,6 @@ public:
}
public:
/// <summary>
/// Adds the specified value to the buffer.
/// </summary>
@@ -146,7 +143,6 @@ public:
}
public:
/// <summary>
/// Gets the minimum value in the buffer.
/// </summary>

View File

@@ -11,14 +11,12 @@
class FLAXENGINE_API Sorting
{
public:
/// <summary>
/// Helper collection used by the sorting algorithms. Implements stack using single linear allocation with variable capacity.
/// </summary>
class FLAXENGINE_API SortingStack
{
public:
static SortingStack& Get();
int32 Count = 0;
@@ -47,7 +45,6 @@ public:
};
public:
/// <summary>
/// Sorts the linear data array using Quick Sort algorithm (non recursive version, uses temporary stack collection).
/// </summary>

View File

@@ -51,7 +51,6 @@ class ScriptingObject;
struct FLAXENGINE_API CommonValue
{
public:
/// <summary>
/// Type
/// </summary>
@@ -86,7 +85,6 @@ public:
};
public:
// 0.0f (floating-point value type)
static const CommonValue Zero;
@@ -103,7 +101,6 @@ public:
static const CommonValue True;
public:
/// <summary>
/// Default constructor (bool)
/// </summary>
@@ -365,7 +362,6 @@ public:
}
public:
/// <summary>
/// Assignment operator
/// </summary>
@@ -426,7 +422,6 @@ public:
}
public:
/// <summary>
/// Gets value as boolean (if can convert it)
/// </summary>
@@ -742,7 +737,6 @@ public:
}
public:
/// <summary>
/// Set new value and change type to Bool
/// </summary>
@@ -944,7 +938,6 @@ public:
}
public:
/// <summary>
/// Change common value type
/// </summary>
@@ -975,7 +968,6 @@ public:
}
public:
/// <summary>
/// Casts value from its type to another
/// </summary>
@@ -1027,7 +1019,6 @@ public:
}
public:
friend bool operator==(const CommonValue& a, const CommonValue& b)
{
ASSERT(a.Type == b.Type);
@@ -1097,20 +1088,20 @@ public:
return a.AsVector3 > b.AsVector3;
case CommonType::Vector4:
return a.AsVector4 > b.AsVector4;
//case CommonType::Color: return a.AsColor > b.AsColor;
//case CommonType::Guid: return a.AsGuid > b.AsGuid;
//case CommonType::Color: return a.AsColor > b.AsColor;
//case CommonType::Guid: return a.AsGuid > b.AsGuid;
case CommonType::String:
return StringUtils::Compare(a.AsString, b.AsString) > 0;
//case CommonType::Box: return a.AsBox > b.AsBox;
//case CommonType::Rotation: return a.AsRotation > b.AsRotation;
//case CommonType::Transform: return a.AsTransform > b.AsTransform;
//case CommonType::Sphere: return a.AsSphere > b.AsSphere;
//case CommonType::Rectangle: return a.AsRectangle > b.AsRectangle;
//case CommonType::Ray: return a.AsRay > b.AsRay;
//case CommonType::Box: return a.AsBox > b.AsBox;
//case CommonType::Rotation: return a.AsRotation > b.AsRotation;
//case CommonType::Transform: return a.AsTransform > b.AsTransform;
//case CommonType::Sphere: return a.AsSphere > b.AsSphere;
//case CommonType::Rectangle: return a.AsRectangle > b.AsRectangle;
//case CommonType::Ray: return a.AsRay > b.AsRay;
case CommonType::Pointer:
case CommonType::Object:
return a.AsPointer > b.AsPointer;
//case CommonType::Matrix: return a.AsMatrix > b.AsMatrix;
//case CommonType::Matrix: return a.AsMatrix > b.AsMatrix;
case CommonType::Blob:
return a.AsBlob.Length > b.AsBlob.Length;
default: CRASH;
@@ -1134,7 +1125,6 @@ public:
}
public:
static bool NearEqual(const CommonValue& a, const CommonValue& b, float epsilon);
static CommonValue Lerp(const CommonValue& a, const CommonValue& b, float alpha);
@@ -1143,7 +1133,6 @@ public:
Guid GetObjectId() const;
private:
void OnObjectDeleted(ScriptingObject* obj)
{
AsObject = nullptr;

View File

@@ -15,15 +15,12 @@ template<typename T>
class DataContainer : public Span<T>
{
public:
typedef Span<T> Base;
private:
bool _isAllocated;
public:
/// <summary>
/// Initializes a new instance of the <see cref="DataContainer"/> class.
/// </summary>
@@ -129,7 +126,6 @@ public:
}
public:
/// <summary>
/// Returns true if data is allocated by container itself, otherwise it's just linked.
/// </summary>
@@ -339,7 +335,6 @@ public:
}
public:
template<typename ReadStream>
void Read(ReadStream* stream, int32 length)
{

View File

@@ -23,14 +23,12 @@ DECLARE_ENUM_EX_12(MonthOfYear, int32, 1, January, February, March, April, May,
API_STRUCT(InBuild, Namespace="System") struct FLAXENGINE_API DateTime
{
public:
/// <summary>
/// Ticks in 100 nanoseconds resolution since January 1, 0001 A.D.
/// </summary>
int64 Ticks;
public:
/// <summary>
/// Empty constructor.
/// </summary>
@@ -60,7 +58,6 @@ public:
DateTime(int32 year, int32 month, int32 day, int32 hour = 0, int32 minute = 0, int32 second = 0, int32 millisecond = 0);
public:
/// <summary>
/// Gets the string.
/// </summary>
@@ -72,7 +69,6 @@ public:
String ToFileNameString() const;
public:
DateTime operator+(const TimeSpan& other) const;
DateTime& operator+=(const TimeSpan& other);
TimeSpan operator-(const DateTime& other) const;
@@ -110,7 +106,6 @@ public:
}
public:
/// <summary>
/// Gets the date part of this date. The time part is truncated and becomes 00:00:00.000.
/// </summary>
@@ -210,7 +205,6 @@ public:
int32 ToUnixTimestamp() const;
public:
/// <summary>
/// Gets the number of days in the year and month.
/// </summary>

View File

@@ -63,7 +63,7 @@ FORCE_INLINE void GuidToString(const CharType* cachedGuidDigits, CharType* buffe
break;
}
case Guid::FormatType::B:
// TODO: impl GuidToString for FormatType::B:
// TODO: impl GuidToString for FormatType::B:
case Guid::FormatType::P:
// TODO: impl GuidToString for FormatType::P:
default:
@@ -89,7 +89,7 @@ FORCE_INLINE bool GuidParse(const StringViewType& text, Guid& value)
{
switch (text.Length())
{
// FormatType::N
// FormatType::N
case 32:
{
return
@@ -98,7 +98,7 @@ FORCE_INLINE bool GuidParse(const StringViewType& text, Guid& value)
StringUtils::ParseHex(*text + 16, 8, &value.C) ||
StringUtils::ParseHex(*text + 24, 8, &value.D);
}
// FormatType::D
// FormatType::D
case 36:
{
StringType b = StringType(text.Substring(9, 4)) + text.Substring(14, 4);
@@ -109,8 +109,8 @@ FORCE_INLINE bool GuidParse(const StringViewType& text, Guid& value)
StringUtils::ParseHex(*c, &value.C) ||
StringUtils::ParseHex(*text + 28, 8, &value.D);
}
// FormatType::B
// FormatType::P
// FormatType::B
// FormatType::P
case 38:
{
StringType b = StringType(text.Substring(10, 4)) + text.Substring(15, 4);

View File

@@ -15,7 +15,6 @@ class String;
API_STRUCT(InBuild, Namespace="System") struct FLAXENGINE_API Guid
{
public:
/// <summary>
/// Accepted format specifiers for the format parameter
/// </summary>
@@ -39,7 +38,6 @@ public:
};
public:
union
{
struct
@@ -65,12 +63,10 @@ public:
};
public:
// Empty Guid (considered as invalid ID)
static Guid Empty;
public:
/// <summary>
/// Empty constructor.
/// </summary>
@@ -92,7 +88,6 @@ public:
}
public:
// Compares two Guids for equality
// @param left The first Guid to compare
// @param right The second Guid to compare
@@ -152,14 +147,12 @@ public:
}
public:
String ToString() const;
String ToString(FormatType format) const;
void ToString(char* buffer, FormatType format) const;
void ToString(Char* buffer, FormatType format) const;
public:
/// <summary>
/// Try to parse Guid from string
/// </summary>

View File

@@ -10,7 +10,7 @@
/// </summary>
API_STRUCT() struct FLAXENGINE_API LayersMask
{
DECLARE_SCRIPTING_TYPE_MINIMAL(LayersMask);
DECLARE_SCRIPTING_TYPE_MINIMAL(LayersMask);
/// <summary>
/// The layers selection mask.
@@ -18,7 +18,6 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(LayersMask);
API_FIELD() uint32 Mask = MAX_uint32;
public:
FORCE_INLINE LayersMask()
{
}

View File

@@ -11,12 +11,10 @@ template<typename T>
struct NullableBase
{
protected:
bool _hasValue;
T _value;
public:
/// <summary>
/// Initializes a new instance of the <see cref="NullableBase{T}"/> struct.
/// </summary>
@@ -46,7 +44,6 @@ public:
}
public:
/// <summary>
/// Gets a value indicating whether the current NullableBase{T} object has a valid value of its underlying type.
/// </summary>
@@ -95,7 +92,6 @@ public:
}
public:
/// <summary>
/// Indicates whether the current NullableBase{T} object is equal to a specified object.
/// </summary>
@@ -129,7 +125,6 @@ template<typename T>
struct Nullable : NullableBase<T>
{
public:
/// <summary>
/// Initializes a new instance of the <see cref="Nullable{T}"/> struct.
/// </summary>
@@ -164,7 +159,6 @@ template<>
struct Nullable<bool> : NullableBase<bool>
{
public:
/// <summary>
/// Initializes a new instance of the <see cref="Nullable{T}"/> struct.
/// </summary>
@@ -192,7 +186,6 @@ public:
}
public:
/// <summary>
/// Gets a value indicating whether the current Nullable{T} object has a valid value and it's set to true.
/// </summary>

View File

@@ -12,7 +12,6 @@ template<typename T, typename U>
class Pair
{
public:
/// <summary>
/// The first element.
/// </summary>
@@ -24,7 +23,6 @@ public:
U Second;
public:
/// <summary>
/// Initializes a new instance of the <see cref="Pair"/> class.
/// </summary>
@@ -64,7 +62,6 @@ public:
}
public:
Pair& operator=(const Pair& other)
{
if (this == &other)

View File

@@ -11,12 +11,10 @@ template<typename T>
class Span
{
protected:
T* _data;
int32 _length;
public:
/// <summary>
/// Initializes a new instance of the <see cref="Span"/> class.
/// </summary>
@@ -38,7 +36,6 @@ public:
}
public:
/// <summary>
/// Returns true if data is valid.
/// </summary>
@@ -95,7 +92,6 @@ public:
}
public:
/// <summary>
/// Gets or sets the element by index
/// </summary>

View File

@@ -13,12 +13,10 @@ template<typename T>
class StringBase
{
protected:
T* _data = nullptr;
int32 _length = 0;
public:
/// <summary>
/// Finalizes an instance of the <see cref="StringBase"/> class.
/// </summary>
@@ -28,7 +26,6 @@ public:
}
public:
/// <summary>
/// Clears this instance. Frees the memory and sets the string to empty.
/// </summary>
@@ -40,7 +37,6 @@ public:
}
public:
/// <summary>
/// Gets the character at the specific index.
/// </summary>
@@ -64,7 +60,6 @@ public:
}
public:
/// <summary>
/// Lexicographically tests how this string compares to the other given string.
/// In case sensitive mode 'A' is less than 'a'.
@@ -80,7 +75,6 @@ public:
}
public:
/// <summary>
/// Returns true if string is empty.
/// </summary>
@@ -154,7 +148,6 @@ public:
}
public:
/// <summary>
/// Checks whether this string contains the specified substring.
/// </summary>
@@ -353,7 +346,6 @@ public:
}
public:
bool StartsWith(T c, StringSearchCase searchCase = StringSearchCase::CaseSensitive) const
{
const int32 length = Length();
@@ -551,14 +543,12 @@ public:
API_CLASS(InBuild) class FLAXENGINE_API String : public StringBase<Char>
{
public:
/// <summary>
/// Instance of the empty string.
/// </summary>
static String Empty;
public:
/// <summary>
/// Initializes a new instance of the <see cref="String"/> class.
/// </summary>
@@ -646,7 +636,6 @@ public:
explicit String(const StringAnsiView& str);
public:
/// <summary>
/// Sets an array of characters to the string.
/// </summary>
@@ -775,7 +764,6 @@ public:
}
public:
/// <summary>
/// Sets the text value.
/// </summary>
@@ -848,7 +836,6 @@ public:
}
public:
// @formatter:off
FORCE_INLINE friend String operator+(const String& a, const String& b)
{
@@ -941,7 +928,6 @@ public:
// @formatter:on
public:
/// <summary>
/// Checks if string contains only ANSI characters.
/// </summary>
@@ -949,7 +935,6 @@ public:
bool IsANSI() const;
public:
using StringBase::StartsWith;
bool StartsWith(const StringView& prefix, StringSearchCase searchCase = StringSearchCase::CaseSensitive) const;
@@ -1060,7 +1045,6 @@ public:
String TrimTrailing() const;
public:
/// <summary>
/// Formats the message and gets it as a string.
/// </summary>
@@ -1077,7 +1061,6 @@ public:
}
public:
/// <summary>
/// Concatenates this path with given path ensuring the '/' character is used between them.
/// </summary>
@@ -1167,7 +1150,6 @@ public:
}
public:
String ToString() const
{
return *this;
@@ -1176,7 +1158,6 @@ public:
StringAnsi ToStringAnsi() const;
private:
template<typename T1, typename T2>
static String ConcatStrings(T1 left, T2 right)
{
@@ -1267,14 +1248,12 @@ namespace fmt
API_CLASS(InBuild) class FLAXENGINE_API StringAnsi : public StringBase<char>
{
public:
/// <summary>
/// Instance of the empty string.
/// </summary>
static StringAnsi Empty;
public:
/// <summary>
/// Initializes a new instance of the <see cref="StringAnsi"/> class.
/// </summary>
@@ -1361,7 +1340,6 @@ public:
explicit StringAnsi(const StringAnsiView& str);
public:
/// <summary>
/// Sets an array of characters to the string.
/// </summary>
@@ -1483,7 +1461,6 @@ public:
}
public:
/// <summary>
/// Sets the text value.
/// </summary>
@@ -1556,7 +1533,6 @@ public:
}
public:
// @formatter:off
FORCE_INLINE friend StringAnsi operator+(const StringAnsi& a, const StringAnsi& b)
{
@@ -1641,7 +1617,6 @@ public:
// @formatter:on
public:
using StringBase::StartsWith;
bool StartsWith(const StringAnsiView& prefix, StringSearchCase searchCase = StringSearchCase::CaseSensitive) const;
@@ -1727,7 +1702,6 @@ public:
void Split(char c, Array<StringAnsi, HeapAllocation>& results) const;
public:
/// <summary>
/// Formats the message and gets it as a string.
/// </summary>
@@ -1744,7 +1718,6 @@ public:
}
public:
String ToString() const
{
return String(Get(), Length());
@@ -1756,7 +1729,6 @@ public:
}
private:
template<typename T1, typename T2>
static StringAnsi ConcatStrings(T1 left, T2 right)
{

View File

@@ -11,14 +11,12 @@
class FLAXENGINE_API StringBuilder
{
private:
/// <summary>
/// Array with characters of the string (it's not null-terminated)
/// </summary>
Array<Char> _data;
public:
/// <summary>
/// Init
/// </summary>
@@ -36,7 +34,6 @@ public:
}
public:
/// <summary>
/// Gets capacity
/// </summary>
@@ -82,7 +79,6 @@ public:
}
public:
// Append single character to the string
// @param c Character to append
// @return Current String Builder instance
@@ -175,7 +171,6 @@ public:
}
public:
StringBuilder& AppendLine()
{
Append(TEXT(PLATFORM_LINE_TERMINATOR));
@@ -224,7 +219,6 @@ public:
}
public:
// Retrieves substring created from characters starting from startIndex
// @param startIndex Index of the first character to subtract
// @param count Amount of characters to retrieve
@@ -236,7 +230,6 @@ public:
}
public:
// Get pointer to the string
// @returns Pointer to Array of Chars if Num, otherwise the empty string
FORCE_INLINE const Char* operator*() const
@@ -264,7 +257,6 @@ public:
}
public:
String ToString() const
{
return String(_data.Get(), _data.Count());

View File

@@ -13,7 +13,6 @@ template<typename T>
class StringViewBase
{
protected:
const T* _data;
int32 _length;
@@ -30,7 +29,6 @@ protected:
}
public:
/// <summary>
/// Gets the specific const character from this string.
/// </summary>
@@ -41,7 +39,7 @@ public:
ASSERT(index >= 0 && index <= _length);
return _data[index];
}
FORCE_INLINE StringViewBase& operator=(const StringViewBase& other)
{
if (this != &other)
@@ -53,8 +51,7 @@ public:
}
/// <summary>
/// Lexicographically tests how this string compares to the other given string.
/// In case sensitive mode 'A' is less than 'a'.
/// Lexicographically tests how this string compares to the other given string. In case sensitive mode 'A' is less than 'a'.
/// </summary>
/// <param name="str">The another string test against.</param>
/// <param name="searchCase">The case sensitivity mode.</param>
@@ -63,9 +60,7 @@ public:
{
const bool thisIsShorter = Length() < str.Length();
const int32 minLength = thisIsShorter ? Length() : str.Length();
const int32 prefixCompare = (searchCase == StringSearchCase::CaseSensitive)
? StringUtils::Compare(this->GetNonTerminatedText(), str.GetNonTerminatedText(), minLength)
: StringUtils::CompareIgnoreCase(this->GetNonTerminatedText(), str.GetNonTerminatedText(), minLength);
const int32 prefixCompare = searchCase == StringSearchCase::CaseSensitive ? StringUtils::Compare(GetNonTerminatedText(), str.GetNonTerminatedText(), minLength) : StringUtils::CompareIgnoreCase(GetNonTerminatedText(), str.GetNonTerminatedText(), minLength);
if (prefixCompare != 0)
return prefixCompare;
if (Length() == str.Length())
@@ -74,7 +69,6 @@ public:
}
public:
/// <summary>
/// Returns true if string is empty.
/// </summary>
@@ -124,7 +118,6 @@ public:
}
public:
/// <summary>
/// Searches the string for the occurrence of a character.
/// </summary>
@@ -205,14 +198,12 @@ public:
API_CLASS(InBuild) class FLAXENGINE_API StringView : public StringViewBase<Char>
{
public:
/// <summary>
/// Instance of the empty string.
/// </summary>
static StringView Empty;
public:
/// <summary>
/// Initializes a new instance of the <see cref="StringView"/> class.
/// </summary>
@@ -257,7 +248,6 @@ public:
}
public:
/// <summary>
/// Assigns the static string.
/// </summary>
@@ -325,7 +315,6 @@ public:
bool operator!=(const String& other) const;
public:
/// <summary>
/// Gets the left most given number of characters.
/// </summary>
@@ -356,7 +345,6 @@ public:
StringView Substring(int32 startIndex, int32 count) const;
public:
String ToString() const;
StringAnsi ToStringAnsi() const;
};
@@ -394,14 +382,12 @@ namespace fmt
API_CLASS(InBuild) class FLAXENGINE_API StringAnsiView : public StringViewBase<char>
{
public:
/// <summary>
/// Instance of the empty string.
/// </summary>
static StringAnsiView Empty;
public:
/// <summary>
/// Initializes a new instance of the <see cref="StringView"/> class.
/// </summary>
@@ -446,7 +432,6 @@ public:
}
public:
/// <summary>
/// Assigns the static string.
/// </summary>
@@ -514,7 +499,6 @@ public:
bool operator!=(const StringAnsi& other) const;
public:
/// <summary>
/// Retrieves substring created from characters starting from startIndex to the String end.
/// </summary>
@@ -531,7 +515,6 @@ public:
StringAnsi Substring(int32 startIndex, int32 count) const;
public:
String ToString() const;
StringAnsi ToStringAnsi() const;
};

View File

@@ -33,14 +33,12 @@ namespace Constants
API_STRUCT(InBuild, Namespace="System") struct FLAXENGINE_API TimeSpan
{
public:
/// <summary>
/// Time span in 100 nanoseconds resolution.
/// </summary>
int64 Ticks;
public:
/// <summary>
/// Empty constructor.
/// </summary>
@@ -88,7 +86,6 @@ public:
}
public:
// Get string
String ToString() const;
@@ -99,7 +96,6 @@ public:
String ToString(const char option) const;
public:
FORCE_INLINE TimeSpan operator+(const TimeSpan& other) const
{
return TimeSpan(Ticks + other.Ticks);
@@ -169,7 +165,6 @@ public:
}
public:
/// <summary>
/// Gets the days component of this time span.
/// </summary>
@@ -259,7 +254,6 @@ public:
}
public:
/// <summary>
/// Creates a time span that represents the specified number of days.
/// </summary>
@@ -296,7 +290,6 @@ public:
static TimeSpan FromSeconds(double seconds);
public:
/// <summary>
/// Returns the maximum time span value.
/// </summary>
@@ -325,7 +318,6 @@ public:
}
private:
void Set(int32 days, int32 hours, int32 minutes, int32 seconds, int32 milliseconds);
};

View File

@@ -78,7 +78,6 @@ API_STRUCT(InBuild) struct FLAXENGINE_API VariantType
};
public:
/// <summary>
/// The type of the variant.
/// </summary>
@@ -90,7 +89,6 @@ public:
char* TypeName;
public:
FORCE_INLINE VariantType()
{
Type = Null;
@@ -116,7 +114,6 @@ public:
}
public:
VariantType& operator=(const Types& type);
VariantType& operator=(VariantType&& other);
VariantType& operator=(const VariantType& other);
@@ -129,7 +126,6 @@ public:
}
public:
void SetTypeName(const StringView& typeName);
void SetTypeName(const StringAnsiView& typeName);
const char* GetTypeName() const;
@@ -179,7 +175,6 @@ API_STRUCT(InBuild) struct FLAXENGINE_API Variant
};
public:
// 0.0f (floating-point value type)
static const Variant Zero;
@@ -196,7 +191,6 @@ public:
static const Variant True;
public:
FORCE_INLINE Variant()
{
}
@@ -252,7 +246,6 @@ public:
~Variant();
public:
Variant& operator=(Variant&& other);
Variant& operator=(const Variant& other);
bool operator==(const Variant& other) const;
@@ -279,7 +272,6 @@ public:
}
public:
explicit operator bool() const;
explicit operator Char() const;
explicit operator int8() const;
@@ -293,8 +285,8 @@ public:
explicit operator float() const;
explicit operator double() const;
explicit operator void*() const;
explicit operator StringView() const; // Returned StringView, if not empty, is guaranteed to point to a null terminated buffer.
explicit operator StringAnsiView() const; // Returned StringView, if not empty, is guaranteed to point to a null terminated buffer.
explicit operator StringView() const; // Returned StringView, if not empty, is guaranteed to point to a null terminated buffer.
explicit operator StringAnsiView() const; // Returned StringView, if not empty, is guaranteed to point to a null terminated buffer.
explicit operator ScriptingObject*() const;
explicit operator struct _MonoObject*() const;
explicit operator Asset*() const;
@@ -346,7 +338,6 @@ public:
const Array<Variant, HeapAllocation>& AsArray() const;
public:
void SetType(const VariantType& type);
void SetType(VariantType&& type);
void SetString(const StringView& str);
@@ -366,7 +357,6 @@ public:
}
public:
template<typename T>
static typename TEnableIf<TIsEnum<T>::Value, Variant>::Type Enum(VariantType&& type, const T value)
{
@@ -393,7 +383,6 @@ public:
static Variant Lerp(const Variant& a, const Variant& b, float alpha);
private:
void OnObjectDeleted(ScriptingObject* obj)
{
AsObject = nullptr;

View File

@@ -12,14 +12,12 @@
struct FLAXENGINE_API Version
{
private:
int32 _major;
int32 _minor;
int32 _build;
int32 _revision;
public:
/// <summary>
/// Initializes a new instance of the Version class with the specified major, minor, build, and revision numbers.
/// </summary>
@@ -74,7 +72,6 @@ public:
}
public:
/// <summary>
/// Gets the value of the build component of the version number for the current Version object.
/// </summary>
@@ -130,7 +127,6 @@ public:
}
public:
/// <summary>
/// Compares the current Version object to a specified Version object and returns an indication of their relative values.
/// </summary>
@@ -209,7 +205,6 @@ public:
}
public:
/// <summary>
/// Converts the value of the current Version object to its equivalent <see cref="T:String" /> representation.
/// A specified count indicates the number of components to return.
@@ -221,7 +216,6 @@ public:
String ToString() const;
public:
/// <summary>
/// Try to parse Version from string.
/// </summary>

View File

@@ -26,7 +26,7 @@ class SceneRenderTask;
/// </summary>
API_CLASS(Abstract) class FLAXENGINE_API Actor : public SceneObject
{
DECLARE_SCENE_OBJECT(Actor);
DECLARE_SCENE_OBJECT(Actor);
friend Level;
friend PrefabManager;
friend Scene;
@@ -35,7 +35,6 @@ DECLARE_SCENE_OBJECT(Actor);
friend PrefabInstanceData;
protected:
int8 _isActive : 1;
int8 _isActiveInHierarchy : 1;
int8 _isPrefabRoot : 1;
@@ -53,13 +52,11 @@ protected:
PhysicsScene* _physicsScene;
private:
// Disable copying
Actor(Actor const&) = delete;
Actor& operator=(Actor const&) = delete;
public:
/// <summary>
/// List with all child actors attached to the actor (readonly). All items are valid (not null).
/// </summary>
@@ -79,7 +76,6 @@ public:
HideFlags HideFlags;
public:
/// <summary>
/// Gets the object layer (index). Can be used for selective rendering or ignoring raycasts.
/// </summary>
@@ -164,7 +160,6 @@ public:
API_PROPERTY() void SetName(const StringView& value);
public:
/// <summary>
/// Gets the scene object which contains this actor.
/// </summary>
@@ -251,7 +246,6 @@ public:
API_FUNCTION(Attributes="NoAnimate") void DestroyChildren(float timeLeft = 0.0f);
public:
/// <summary>
/// Gets amount of scripts.
/// </summary>
@@ -308,7 +302,6 @@ public:
}
public:
/// <summary>
/// Gets value indicating if actor is active in the scene.
/// </summary>
@@ -401,7 +394,6 @@ public:
}
public:
/// <summary>
/// Gets the actor's world transformation.
/// </summary>
@@ -475,7 +467,6 @@ public:
API_PROPERTY() void SetRotation(const Matrix& value);
public:
/// <summary>
/// Gets the random per-instance value (normalized to range 0-1).
/// </summary>
@@ -501,7 +492,6 @@ public:
API_PROPERTY() void SetDirection(const Float3& value);
public:
/// <summary>
/// Resets the actor local transform.
/// </summary>
@@ -599,7 +589,6 @@ public:
}
public:
/// <summary>
/// Gets actor bounding sphere that defines 3D space intersecting with the actor (for determination of the visibility for actor).
/// </summary>
@@ -646,7 +635,6 @@ public:
void UnregisterObjectHierarchy();
public:
/// <summary>
/// Draws this actor. Called by Scene Rendering service. This call is more optimized than generic Draw (eg. geometry is rendered during all pass types but other actors are drawn only during GBufferFill pass).
/// </summary>
@@ -668,7 +656,6 @@ public:
#endif
public:
/// <summary>
/// Changes the script order.
/// </summary>
@@ -689,7 +676,6 @@ public:
API_PROPERTY() bool IsPrefabRoot() const;
public:
/// <summary>
/// Tries to find the actor with the given name in this actor hierarchy (checks this actor and all children hierarchy).
/// </summary>
@@ -790,7 +776,6 @@ public:
API_FUNCTION() Quaternion LookingAt(const Vector3& worldPos, const Vector3& worldUp) const;
public:
/// <summary>
/// Execute custom action on actors tree.
/// Action should returns false to stop calling deeper.
@@ -827,7 +812,6 @@ public:
}
public:
/// <summary>
/// Performs actors serialization to the raw bytes.
/// </summary>
@@ -887,7 +871,6 @@ public:
API_FUNCTION() void FromJson(const StringAnsiView& json);
public:
/// <summary>
/// Called when actor gets added to game systems. Occurs on BeginPlay event or when actor gets activated in hierarchy. Use this event to register object to other game system (eg. audio).
/// </summary>
@@ -969,10 +952,11 @@ public:
API_PROPERTY(Attributes="HideInEditor") PhysicsScene* GetPhysicsScene() const;
protected:
virtual void OnPhysicsSceneChanged(PhysicsScene* previous) {}
virtual void OnPhysicsSceneChanged(PhysicsScene* previous)
{
}
private:
void SetSceneInHierarchy(Scene* scene);
void OnEnableInHierarchy();
void OnDisableInHierarchy();
@@ -982,7 +966,6 @@ private:
static bool IsSubClassOf(const Script* object, const MClass* klass);
public:
// [ScriptingObject]
String ToString() const override;
void OnDeleteObject() override;

View File

@@ -693,9 +693,9 @@ void AnimatedModel::Update()
void AnimatedModel::Draw(RenderContext& renderContext)
{
if (renderContext.View.Pass == DrawPass::GlobalSDF)
return; // TODO: Animated Model rendering to Global SDF
return; // TODO: Animated Model rendering to Global SDF
if (renderContext.View.Pass == DrawPass::GlobalSurfaceAtlas)
return; // No supported
return; // No supported
GEOMETRY_DRAW_STATE_EVENT_BEGIN(_drawState, _world);
const DrawPass drawModes = (DrawPass)(DrawModes & renderContext.View.Pass & (int32)renderContext.View.GetShadowsDrawPassMask(ShadowsMode));

View File

@@ -14,10 +14,9 @@
/// </summary>
API_CLASS() class FLAXENGINE_API AnimatedModel : public ModelInstanceActor
{
DECLARE_SCENE_OBJECT(AnimatedModel);
DECLARE_SCENE_OBJECT(AnimatedModel);
friend class AnimationsSystem;
public:
/// <summary>
/// Describes the animation graph updates frequency for the animated model.
/// </summary>
@@ -55,7 +54,6 @@ public:
};
private:
BoundingBox _boxLocal;
Matrix _world;
GeometryDrawStateData _drawState;
@@ -68,7 +66,6 @@ private:
ScriptingObjectReference<AnimatedModel> _masterPose;
public:
/// <summary>
/// The skinned model asset used for rendering.
/// </summary>
@@ -154,7 +151,6 @@ public:
ScriptingObjectReference<Actor> RootMotionTarget;
public:
/// <summary>
/// The graph instance data container. For dynamic usage only at runtime, not serialized.
/// </summary>
@@ -238,7 +234,6 @@ public:
API_FUNCTION() void SetMasterPoseModel(AnimatedModel* masterPose);
public:
/// <summary>
/// Gets the anim graph instance parameters collection.
/// </summary>
@@ -283,7 +278,6 @@ public:
API_FUNCTION() void SetParameterValue(const Guid& id, const Variant& value);
public:
/// <summary>
/// Gets the weight of the blend shape.
/// </summary>
@@ -304,7 +298,6 @@ public:
API_FUNCTION() void ClearBlendShapeWeights();
public:
/// <summary>
/// Plays the animation on the slot in Anim Graph.
/// </summary>
@@ -353,7 +346,6 @@ public:
API_FUNCTION() bool IsPlayingSlotAnimation(const StringView& slotName, Animation* anim);
private:
void ApplyRootMotion(const RootMotionData& rootMotionDelta);
void SyncParameters();
@@ -372,7 +364,6 @@ private:
void OnGraphLoaded();
public:
// [ModelInstanceActor]
bool HasContentLoaded() const override;
void Draw(RenderContext& renderContext) override;
@@ -387,7 +378,6 @@ public:
bool IntersectsEntry(const Ray& ray, Real& distance, Vector3& normal, int32& entryIndex) override;
protected:
// [ModelInstanceActor]
void BeginPlay(SceneBeginData* data) override;
void EndPlay() override;

View File

@@ -104,7 +104,7 @@ void BoneSocket::OnParentChanged()
{
// Base
Actor::OnParentChanged();
if (!IsDuringPlay())
return;

View File

@@ -9,16 +9,14 @@
/// </summary>
API_CLASS() class FLAXENGINE_API BoneSocket : public Actor
{
DECLARE_SCENE_OBJECT(BoneSocket);
DECLARE_SCENE_OBJECT(BoneSocket);
private:
String _node;
int32 _index;
bool _useScale;
public:
/// <summary>
/// Gets the target node name to link to it.
/// </summary>
@@ -54,7 +52,6 @@ public:
void SetUseScale(bool value);
public:
/// <summary>
/// Updates the actor transformation based on a skeleton node.
/// </summary>
@@ -62,7 +59,6 @@ public:
void UpdateTransformation();
public:
// [Actor]
#if USE_EDITOR
void OnDebugDrawSelected() override;
@@ -71,7 +67,6 @@ public:
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;
protected:
// [Actor]
void OnTransformChanged() override;
void OnParentChanged() override;

View File

@@ -12,7 +12,7 @@
/// </summary>
API_STRUCT() struct BrushSurface : ISerializable
{
DECLARE_SCRIPTING_TYPE_NO_SPAWN(BrushSurface);
DECLARE_SCRIPTING_TYPE_NO_SPAWN(BrushSurface);
/// <summary>
/// The parent brush.
@@ -57,7 +57,6 @@ DECLARE_SCRIPTING_TYPE_NO_SPAWN(BrushSurface);
float ScaleInLightmap = 1.0f;
public:
// [ISerializable]
void Serialize(SerializeStream& stream, const void* otherObj) override;
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;
@@ -68,16 +67,14 @@ public:
/// </summary>
API_CLASS() class FLAXENGINE_API BoxBrush : public Actor, public CSG::Brush
{
DECLARE_SCENE_OBJECT(BoxBrush);
DECLARE_SCENE_OBJECT(BoxBrush);
private:
Vector3 _center;
Vector3 _size;
OrientedBoundingBox _bounds;
BrushMode _mode;
public:
/// <summary>
/// Brush surfaces scale in lightmap
/// </summary>
@@ -161,7 +158,6 @@ public:
API_FUNCTION() void SetMaterial(int32 surfaceIndex, MaterialBase* material);
public:
/// <summary>
/// Gets the volume bounding box (oriented).
/// </summary>
@@ -191,7 +187,6 @@ public:
API_FUNCTION() void GetVertices(int32 surfaceIndex, API_PARAM(Out) Array<Vector3>& outputData) const;
private:
FORCE_INLINE void UpdateBounds()
{
OrientedBoundingBox::CreateCentered(_center, _size, _bounds);
@@ -201,7 +196,6 @@ private:
}
public:
// [Actor]
void Serialize(SerializeStream& stream, const void* otherObj) override;
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;
@@ -219,7 +213,6 @@ public:
int32 GetSurfacesCount() override;
protected:
// [Actor]
void OnTransformChanged() override;
void OnActiveInTreeChanged() override;

View File

@@ -10,14 +10,12 @@
/// </summary>
API_CLASS(Abstract) class FLAXENGINE_API BoxVolume : public Actor
{
DECLARE_SCENE_OBJECT(BoxVolume);
DECLARE_SCENE_OBJECT(BoxVolume);
protected:
Vector3 _size;
OrientedBoundingBox _bounds;
public:
/// <summary>
/// Gets the size of the volume (in local space).
/// </summary>
@@ -41,7 +39,6 @@ public:
}
protected:
virtual void OnBoundsChanged(const BoundingBox& prevBounds)
{
}
@@ -51,7 +48,6 @@ protected:
#endif
public:
// [Actor]
#if USE_EDITOR
void OnDebugDraw() override;
@@ -61,7 +57,6 @@ public:
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;
protected:
// [Actor]
void OnTransformChanged() override;
};

View File

@@ -20,7 +20,7 @@
/// </summary>
API_CLASS(Sealed) class FLAXENGINE_API Camera : public Actor
{
DECLARE_SCENE_OBJECT(Camera);
DECLARE_SCENE_OBJECT(Camera);
// List with all created cameras actors on the scene
static Array<Camera*> Cameras;
@@ -35,7 +35,6 @@ DECLARE_SCENE_OBJECT(Camera);
API_PROPERTY() static Camera* GetMainCamera();
private:
Matrix _view, _projection;
BoundingFrustum _frustum;
@@ -56,7 +55,6 @@ private:
#endif
public:
/// <summary>
/// Gets the view matrix.
/// </summary>
@@ -82,7 +80,6 @@ public:
}
public:
/// <summary>
/// Gets the value indicating if camera should use perspective rendering mode, otherwise it will use orthographic projection.
/// </summary>
@@ -174,7 +171,6 @@ public:
LayersMask RenderLayersMask;
public:
/// <summary>
/// Projects the point from 3D world-space to game window coordinates (in screen pixels for default viewport calculated from <see cref="Viewport"/>).
/// </summary>
@@ -231,14 +227,12 @@ public:
#endif
private:
#if USE_EDITOR
void OnPreviewModelLoaded();
#endif
void UpdateCache();
public:
// [Actor]
#if USE_EDITOR
BoundingBox GetEditorBox() const override;
@@ -250,7 +244,6 @@ public:
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;
protected:
// [Actor]
void OnEnable() override;
void OnDisable() override;

View File

@@ -12,16 +12,14 @@
/// </summary>
API_CLASS() class FLAXENGINE_API Decal : public Actor
{
DECLARE_SCENE_OBJECT(Decal);
DECLARE_SCENE_OBJECT(Decal);
private:
Vector3 _size;
OrientedBoundingBox _bounds;
Matrix _world;
int32 _sceneRenderingKey = -1;
public:
/// <summary>
/// The decal material. Must have domain mode to Decal type.
/// </summary>
@@ -56,7 +54,6 @@ public:
API_PROPERTY() void SetSize(const Vector3& value);
public:
/// <summary>
/// Utility to crate a new virtual Material Instance asset, set its parent to the currently applied material, and assign it to the decal. Can be used to modify the decal material parameters from code.
/// </summary>
@@ -73,7 +70,6 @@ public:
}
public:
// [Actor]
#if USE_EDITOR
void OnDebugDrawSelected() override;
@@ -86,7 +82,6 @@ public:
bool IntersectsItself(const Ray& ray, Real& distance, Vector3& normal) override;
protected:
// [Actor]
void OnEnable() override;
void OnDisable() override;

View File

@@ -9,16 +9,14 @@
/// </summary>
API_CLASS() class FLAXENGINE_API EmptyActor : public Actor
{
DECLARE_SCENE_OBJECT(EmptyActor);
DECLARE_SCENE_OBJECT(EmptyActor);
public:
// [Actor]
#if USE_EDITOR
BoundingBox GetEditorBox() const override;
#endif
protected:
// [Actor]
void OnTransformChanged() override;
};

View File

@@ -11,16 +11,14 @@
/// </summary>
API_CLASS() class FLAXENGINE_API EnvironmentProbe : public Actor
{
DECLARE_SCENE_OBJECT(EnvironmentProbe);
DECLARE_SCENE_OBJECT(EnvironmentProbe);
private:
float _radius;
bool _isUsingCustomProbe;
int32 _sceneRenderingKey = -1;
AssetReference<CubeTexture> _probe;
public:
/// <summary>
/// The reflections brightness.
/// </summary>
@@ -40,7 +38,6 @@ public:
float CaptureNearPlane = 10.0f;
public:
/// <summary>
/// Gets the probe radius.
/// </summary>
@@ -108,7 +105,6 @@ public:
API_PROPERTY() void SetCustomProbe(CubeTexture* probe);
public:
/// <summary>
/// Bakes that probe. It won't be performed now but on async graphics rendering task.
/// </summary>
@@ -122,11 +118,9 @@ public:
void SetProbeData(TextureData& data);
private:
void UpdateBounds();
public:
// [Actor]
#if USE_EDITOR
BoundingBox GetEditorBox() const override
@@ -146,7 +140,6 @@ public:
bool IntersectsItself(const Ray& ray, Real& distance, Vector3& normal) override;
protected:
// [Actor]
void OnEnable() override;
void OnDisable() override;

View File

@@ -33,10 +33,10 @@ void ExponentialHeightFog::Draw(RenderContext& renderContext)
{
// Render only when shader is valid and fog can be rendered
// Do not render exponential fog in orthographic views
if ((renderContext.View.Flags & ViewFlags::Fog) != 0
if ((renderContext.View.Flags & ViewFlags::Fog) != 0
&& renderContext.View.Pass & DrawPass::GBuffer
&& _shader
&& _shader->IsLoaded()
&& _shader
&& _shader->IsLoaded()
&& renderContext.View.IsPerspectiveProjection())
{
// Prepare

View File

@@ -11,9 +11,8 @@
/// </summary>
API_CLASS(Abstract) class FLAXENGINE_API Light : public Actor
{
DECLARE_SCENE_OBJECT_ABSTRACT(Light);
DECLARE_SCENE_OBJECT_ABSTRACT(Light);
public:
/// <summary>
/// Color of the light
/// </summary>
@@ -51,12 +50,10 @@ public:
bool CastVolumetricShadow = true;
protected:
// Adjust the light brightness used during rendering (called by light types inside SetupLightData callback)
void AdjustBrightness(const RenderView& view, float& brightness) const;
public:
// [Actor]
#if USE_EDITOR
BoundingBox GetEditorBox() const override
@@ -74,9 +71,8 @@ public:
/// </summary>
API_CLASS(Abstract) class FLAXENGINE_API LightWithShadow : public Light
{
DECLARE_SCENE_OBJECT_ABSTRACT(LightWithShadow);
DECLARE_SCENE_OBJECT_ABSTRACT(LightWithShadow);
public:
/// <summary>
/// The minimum roughness value used to clamp material surface roughness during shading pixel.
/// </summary>
@@ -132,7 +128,6 @@ public:
ShadowsCastingMode ShadowsMode = ShadowsCastingMode::All;
public:
// [Light]
void Serialize(SerializeStream& stream, const void* otherObj) override;
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;

View File

@@ -11,13 +11,11 @@
/// <seealso cref="Actor" />
API_CLASS(Abstract) class FLAXENGINE_API ModelInstanceActor : public Actor
{
DECLARE_SCENE_OBJECT_ABSTRACT(ModelInstanceActor);
DECLARE_SCENE_OBJECT_ABSTRACT(ModelInstanceActor);
protected:
int32 _sceneRenderingKey = -1;
public:
/// <summary>
/// The model instance buffer.
/// </summary>
@@ -84,12 +82,10 @@ public:
}
public:
// [Actor]
void OnLayerChanged() override;
protected:
// [Actor]
void OnEnable() override;
void OnDisable() override;

View File

@@ -11,16 +11,14 @@
/// </summary>
API_CLASS() class FLAXENGINE_API PostFxVolume : public BoxVolume, public IPostFxSettingsProvider
{
DECLARE_SCENE_OBJECT(PostFxVolume);
DECLARE_SCENE_OBJECT(PostFxVolume);
private:
int32 _priority;
float _blendRadius;
float _blendWeight;
bool _isBounded;
public:
/// <summary>
/// The ambient occlusion effect settings.
/// </summary>
@@ -100,7 +98,6 @@ public:
PostFxMaterialsSettings PostFxMaterials;
public:
/// <summary>
/// Gets the order in which multiple volumes are blended together.
/// The volume with the highest priority takes precedence over all other overlapping volumes.
@@ -184,7 +181,6 @@ public:
}
public:
/// <summary>
/// Adds the post fx material to the settings.
/// </summary>
@@ -198,7 +194,6 @@ public:
API_FUNCTION() void RemovePostFxMaterial(MaterialBase* material);
public:
// [BoxVolume]
bool HasContentLoaded() const override;
void Serialize(SerializeStream& stream, const void* otherObj) override;
@@ -209,7 +204,6 @@ public:
void Blend(PostProcessSettings& other, float weight) override;
protected:
// [BoxVolume]
void OnEnable() override;
void OnDisable() override;

View File

@@ -10,15 +10,13 @@
/// </summary>
API_CLASS() class FLAXENGINE_API Ragdoll : public Actor
{
DECLARE_SCENE_OBJECT(Ragdoll);
API_AUTO_SERIALIZATION();
DECLARE_SCENE_OBJECT(Ragdoll);
API_AUTO_SERIALIZATION();
private:
AnimatedModel* _animatedModel = nullptr;
Dictionary<RigidBody*, Transform> _bonesOffsets;
public:
/// <summary>
/// The default bones weight where 0 means fully animated bone and 1 means fully simulate bones. Can be used to control all bones simulation mode but is overriden by per-bone BonesWeights.
/// </summary>
@@ -53,7 +51,6 @@ public:
float MaxDepenetrationVelocity = MAX_float;
public:
/// <summary>
/// Calculates the total mass of all ragdoll bodies.
/// </summary>
@@ -70,13 +67,11 @@ public:
API_FUNCTION() void SetAngularVelocity(const Vector3& value) const;
private:
float InitBone(RigidBody* rigidBody, int32& nodeIndex, Transform& localPose);
void OnFixedUpdate();
void OnAnimationUpdating(struct AnimGraphImpulse* localPose);
public:
// [Actor]
void OnEnable() override;
void OnDisable() override;

View File

@@ -10,15 +10,13 @@
/// </summary>
API_CLASS() class FLAXENGINE_API Spline : public Actor
{
DECLARE_SCENE_OBJECT(Spline);
DECLARE_SCENE_OBJECT(Spline);
typedef BezierCurveKeyframe<Transform> Keyframe;
private:
bool _loop = false;
BoundingBox _localBounds;
public:
/// <summary>
/// The spline bezier curve points represented as series of transformations in 3D space (with tangents). Points are stored in local-space of the actor.
/// </summary>
@@ -37,7 +35,6 @@ public:
API_PROPERTY() void SetIsLoop(bool value);
public:
/// <summary>
/// Evaluates the spline curve at the given time and calculates the point location in 3D (world-space).
/// </summary>
@@ -215,7 +212,6 @@ public:
API_FUNCTION() void GetSplineLocalPoints(API_PARAM(Out) Array<Transform>& points) const;
public:
/// <summary>
/// Clears the spline to be empty.
/// </summary>
@@ -345,7 +341,6 @@ public:
API_FUNCTION() void SetTangentsSmooth();
public:
/// <summary>
/// Called when spline gets updated (eg. after curve modification).
/// </summary>
@@ -357,7 +352,6 @@ public:
API_FUNCTION() virtual void UpdateSpline();
protected:
#if USE_EDITOR
virtual Color GetSplineColor()
{
@@ -366,7 +360,6 @@ protected:
#endif
private:
// Internal bindings
#if !COMPILE_WITHOUT_CSHARP
API_FUNCTION(NoProxy) void GetKeyframes(MonoArray* data);
@@ -374,7 +367,6 @@ private:
#endif
public:
// [Actor]
#if USE_EDITOR
void OnDebugDraw() override;

View File

@@ -351,9 +351,9 @@ void SplineModel::Draw(RenderContext& renderContext)
return;
auto model = Model.Get();
if (renderContext.View.Pass == DrawPass::GlobalSDF)
return; // TODO: Spline Model rendering to Global SDF
return; // TODO: Spline Model rendering to Global SDF
if (renderContext.View.Pass == DrawPass::GlobalSurfaceAtlas)
return; // TODO: Spline Model rendering to Global Surface Atlas
return; // TODO: Spline Model rendering to Global Surface Atlas
if (!Entries.IsValidFor(model))
Entries.Setup(model);

View File

@@ -12,9 +12,8 @@ class Spline;
/// </summary>
API_CLASS() class FLAXENGINE_API SplineModel : public ModelInstanceActor
{
DECLARE_SCENE_OBJECT(SplineModel);
DECLARE_SCENE_OBJECT(SplineModel);
private:
struct Instance
{
BoundingSphere Sphere;
@@ -33,7 +32,6 @@ private:
float _chunksPerSegment, _meshMinZ, _meshMaxZ;
public:
~SplineModel();
/// <summary>
@@ -104,14 +102,12 @@ public:
API_PROPERTY() void SetForcedLOD(int32 value);
private:
void OnModelChanged();
void OnModelLoaded();
void OnSplineUpdated();
void UpdateDeformationBuffer();
public:
// [ModelInstanceActor]
bool HasContentLoaded() const override;
void Draw(RenderContext& renderContext) override;
@@ -121,7 +117,6 @@ public:
void OnParentChanged() override;
protected:
// [ModelInstanceActor]
void OnTransformChanged() override;
void OnActiveInTreeChanged() override;

View File

@@ -11,9 +11,8 @@
/// </summary>
API_CLASS() class FLAXENGINE_API SpotLight : public LightWithShadow
{
DECLARE_SCENE_OBJECT(SpotLight);
DECLARE_SCENE_OBJECT(SpotLight);
private:
Vector3 _direction;
float _radius;
float _outerConeAngle;
@@ -24,7 +23,6 @@ private:
int32 _sceneRenderingKey = -1;
public:
/// <summary>
/// Light source bulb radius
/// </summary>
@@ -62,7 +60,6 @@ public:
float IESBrightnessScale = 1.0f;
public:
/// <summary>
/// Computes light brightness value
/// </summary>
@@ -122,11 +119,9 @@ public:
API_PROPERTY() void SetInnerConeAngle(float value);
private:
void UpdateBounds();
public:
// [LightWithShadow]
void Draw(RenderContext& renderContext) override;
#if USE_EDITOR
@@ -138,7 +133,6 @@ public:
bool IntersectsItself(const Ray& ray, Real& distance, Vector3& normal) override;
protected:
// [LightWithShadow]
void OnEnable() override;
void OnDisable() override;

View File

@@ -12,9 +12,8 @@
/// </summary>
API_CLASS() class FLAXENGINE_API StaticModel : public ModelInstanceActor
{
DECLARE_SCENE_OBJECT(StaticModel);
DECLARE_SCENE_OBJECT(StaticModel);
private:
Matrix _world;
GeometryDrawStateData _drawState;
float _scaleInLightmap;
@@ -28,7 +27,6 @@ private:
Model* _residencyChangedModel = nullptr;
public:
/// <summary>
/// Finalizes an instance of the <see cref="StaticModel"/> class.
/// </summary>
@@ -52,7 +50,6 @@ public:
LightmapEntry Lightmap;
public:
/// <summary>
/// Gets the model world matrix transform.
/// </summary>
@@ -180,14 +177,12 @@ public:
API_FUNCTION() void RemoveVertexColors();
private:
void OnModelChanged();
void OnModelLoaded();
void OnModelResidencyChanged();
void UpdateBounds();
public:
// [ModelInstanceActor]
bool HasContentLoaded() const override;
void Draw(RenderContext& renderContext) override;
@@ -198,7 +193,6 @@ public:
bool IntersectsEntry(const Ray& ray, Real& distance, Vector3& normal, int32& entryIndex) override;
protected:
// [ModelInstanceActor]
void OnTransformChanged() override;
void OnEnable() override;

View File

@@ -12,13 +12,11 @@
class ActorsCache
{
public:
typedef ActorsLookup ActorsLookupType;
typedef Array<Actor*> ActorsListType;
typedef Array<SceneObject*> SceneObjectsListType;
public:
/// <summary>
/// Gets the actors lookup cached. Safe allocation, per thread, uses caching.
/// </summary>

View File

@@ -59,7 +59,6 @@ enum class SceneEventType
class SceneAction
{
public:
virtual ~SceneAction()
{
}
@@ -113,7 +112,6 @@ using namespace LevelImpl;
class LevelService : public EngineService
{
public:
LevelService()
: EngineService(TEXT("Scene Manager"), 30)
{
@@ -401,7 +399,6 @@ void Level::CollectPostFxVolumes(RenderContext& renderContext)
class LoadSceneAction : public SceneAction
{
public:
Guid SceneId;
AssetReference<JsonAsset> SceneAsset;
@@ -444,7 +441,6 @@ public:
class UnloadSceneAction : public SceneAction
{
public:
Guid TargetScene;
UnloadSceneAction(Scene* scene)
@@ -464,7 +460,6 @@ public:
class UnloadScenesAction : public SceneAction
{
public:
UnloadScenesAction()
{
}
@@ -478,7 +473,6 @@ public:
class SaveSceneAction : public SceneAction
{
public:
Scene* TargetScene;
bool PrettyJson;
@@ -504,7 +498,6 @@ public:
class ReloadScriptsAction : public SceneAction
{
public:
ReloadScriptsAction()
{
}
@@ -655,7 +648,6 @@ void Level::ScriptsReloadRegisterObject(ScriptingObject*& obj)
class SpawnActorAction : public SceneAction
{
public:
ScriptingObjectReference<Actor> TargetActor;
ScriptingObjectReference<Actor> ParentActor;
@@ -674,7 +666,6 @@ public:
class DeleteActorAction : public SceneAction
{
public:
ScriptingObjectReference<Actor> TargetActor;
DeleteActorAction(Actor* actor)

View File

@@ -21,7 +21,7 @@ struct RenderContext;
/// </summary>
API_CLASS(Static) class FLAXENGINE_API Level
{
DECLARE_SCRIPTING_TYPE_NO_SPAWN(Level);
DECLARE_SCRIPTING_TYPE_NO_SPAWN(Level);
friend Engine;
friend Actor;
friend PrefabManager;
@@ -33,7 +33,6 @@ DECLARE_SCRIPTING_TYPE_NO_SPAWN(Level);
#endif
public:
/// <summary>
/// The scenes collection lock.
/// </summary>
@@ -45,7 +44,6 @@ public:
API_FIELD(ReadOnly) static Array<Scene*> Scenes;
public:
/// <summary>
/// Occurs when new actor gets spawned to the game.
/// </summary>
@@ -77,7 +75,6 @@ public:
API_EVENT() static Delegate<Actor*> ActorActiveChanged;
public:
/// <summary>
/// Checks if any scene has been loaded. Loaded scene means deserialized and added to the scenes collection.
/// </summary>
@@ -124,7 +121,6 @@ public:
}
public:
/// <summary>
/// Spawn actor on the scene
/// </summary>
@@ -160,7 +156,6 @@ public:
static void CallBeginPlay(Actor* obj);
public:
/// <summary>
/// Draws all the actors.
/// </summary>
@@ -174,7 +169,6 @@ public:
static void CollectPostFxVolumes(RenderContext& renderContext);
public:
/// <summary>
/// Fired when scene starts saving.
/// </summary>
@@ -246,7 +240,6 @@ public:
#endif
public:
/// <summary>
/// Saves scene to the asset.
/// </summary>
@@ -342,7 +335,6 @@ public:
#endif
public:
/// <summary>
/// Tries to find actor with the given ID. It's very fast O(1) lookup.
/// </summary>
@@ -413,7 +405,6 @@ public:
API_FUNCTION() static Scene* FindScene(const Guid& id);
public:
/// <summary>
/// Gets the scenes.
/// </summary>
@@ -433,7 +424,6 @@ public:
static void GetScenes(Array<Guid>& scenes);
public:
/// <summary>
/// Construct valid and solid list with actors from input list with whole tree for them (valid for fast serialization)
/// </summary>
@@ -449,7 +439,6 @@ public:
static void ConstructParentActorsTreeList(const Array<Actor*>& input, Array<Actor*>& output);
public:
/// <summary>
/// The tags names.
/// </summary>
@@ -479,7 +468,6 @@ public:
API_FUNCTION() static int32 GetLayerIndex(const StringView& layer);
private:
// Actor API
enum class ActorEventType
{

View File

@@ -14,7 +14,6 @@ class SceneLightmapsData;
class Lightmap
{
private:
SceneLightmapsData* _manager;
int32 _index;
#if USE_EDITOR
@@ -23,7 +22,6 @@ private:
AssetReference<Texture> _textures[3];
public:
/// <summary>
/// Initializes a new instance of the <see cref="Lightmap"/> class.
/// </summary>
@@ -33,7 +31,6 @@ public:
Lightmap(SceneLightmapsData* manager, int32 index, const SavedLightmapInfo& info);
public:
/// <summary>
/// Gets attached texture objects
/// </summary>
@@ -99,7 +96,6 @@ public:
bool IsReady() const;
private:
#if USE_EDITOR
bool OnInitLightmap(class TextureData& image);
#endif

View File

@@ -19,7 +19,7 @@ API_CLASS() class FLAXENGINE_API Scene : public Actor
{
friend class Level;
friend class ReloadScriptsAction;
DECLARE_SCENE_OBJECT(Scene);
DECLARE_SCENE_OBJECT(Scene);
/// <summary>
/// Finalizes an instance of the <see cref="Scene"/> class.
@@ -27,7 +27,6 @@ DECLARE_SCENE_OBJECT(Scene);
~Scene();
public:
/// <summary>
/// The scene metadata.
/// </summary>
@@ -80,7 +79,6 @@ public:
API_PROPERTY() void SetLightmapSettings(const LightmapSettings& value);
public:
/// <summary>
/// Removes all baked lightmap textures from the scene.
/// </summary>
@@ -120,7 +118,6 @@ public:
#endif
private:
MeshCollider* TryGetCsgCollider();
StaticModel* TryGetCsgModel();
void CreateCsgCollider();
@@ -132,7 +129,6 @@ private:
#endif
public:
// [Actor]
void Serialize(SerializeStream& stream, const void* otherObj) override;
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;
@@ -140,7 +136,6 @@ public:
void EndPlay() override;
protected:
// [Actor]
void PostLoad() override;
void PostSpawn() override;

View File

@@ -9,7 +9,7 @@
/// </summary>
API_CLASS(NoSpawn) class SceneAsset : public JsonAsset
{
DECLARE_ASSET_HEADER(SceneAsset);
DECLARE_ASSET_HEADER(SceneAsset);
protected:
bool IsInternalType() const override;
};

View File

@@ -20,11 +20,9 @@ namespace CSG
class SceneCSGData : public ISerializable
{
private:
Scene* _scene;
public:
/// <summary>
/// Initializes a new instance of the <see cref="SceneCSGData"/> class.
/// </summary>
@@ -32,7 +30,6 @@ namespace CSG
SceneCSGData(Scene* scene);
public:
/// <summary>
/// CSG mesh building action time (registered by CSG::Builder, in UTC format). Invalid if not build by active engine instance.
/// </summary>
@@ -64,7 +61,6 @@ namespace CSG
Action PostCSGBuild;
public:
/// <summary>
/// Build CSG geometry for the given scene.
/// </summary>
@@ -77,7 +73,6 @@ namespace CSG
bool HasData() const;
public:
struct SurfaceData
{
Array<Triangle> Triangles;
@@ -95,11 +90,9 @@ namespace CSG
bool TryGetSurfaceData(const Guid& brushId, int32 brushSurfaceIndex, SurfaceData& outData);
private:
void OnDataChanged();
public:
// [ISerializable]
void Serialize(SerializeStream& stream, const void* otherObj) override;
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;

View File

@@ -13,12 +13,10 @@ class Lightmap;
class SceneLightmapsData
{
private:
Array<Lightmap*> _lightmaps;
Scene* _scene;
public:
/// <summary>
/// Initializes a new instance of the <see cref="StaticLightManager"/> class.
/// </summary>
@@ -31,7 +29,6 @@ public:
~SceneLightmapsData();
public:
FORCE_INLINE Scene* GetScene() const
{
return _scene;
@@ -64,7 +61,6 @@ public:
}
public:
#if USE_EDITOR
/// <summary>
@@ -84,7 +80,6 @@ public:
#endif
public:
/// <summary>
/// Clear baked lightmaps data
/// </summary>

View File

@@ -13,7 +13,6 @@ class NavMeshBoundsVolume;
class FLAXENGINE_API SceneNavigation
{
public:
/// <summary>
/// The list of registered navigation bounds volumes (on the scene).
/// </summary>

View File

@@ -11,7 +11,6 @@
class FLAXENGINE_API SceneTicking
{
public:
/// <summary>
/// Tick function type.
/// </summary>
@@ -48,7 +47,6 @@ public:
class FLAXENGINE_API TickData
{
public:
Array<Script*> Scripts;
Array<Tick> Ticks;
#if USE_EDITOR
@@ -93,7 +91,6 @@ public:
class FLAXENGINE_API FixedUpdateTickData : public TickData
{
public:
FixedUpdateTickData();
void TickScripts(const Array<Script*>& scripts) override;
};
@@ -101,7 +98,6 @@ public:
class FLAXENGINE_API UpdateTickData : public TickData
{
public:
UpdateTickData();
void TickScripts(const Array<Script*>& scripts) override;
};
@@ -109,13 +105,11 @@ public:
class FLAXENGINE_API LateUpdateTickData : public TickData
{
public:
LateUpdateTickData();
void TickScripts(const Array<Script*>& scripts) override;
};
public:
/// <summary>
/// Adds the script to scene ticking system.
/// </summary>
@@ -134,7 +128,6 @@ public:
void Clear();
public:
/// <summary>
/// The fixed update tick function.
/// </summary>

View File

@@ -14,7 +14,6 @@
class SceneInfo : public Object, public ISerializable
{
public:
/// <summary>
/// Scene title
/// </summary>
@@ -31,7 +30,6 @@ public:
String Copyright;
public:
/// <summary>
/// Array with cached lightmaps ID for the scene
/// </summary>
@@ -43,7 +41,6 @@ public:
LightmapSettings LightmapSettings;
public:
// [Object]
String ToString() const override;

View File

@@ -24,7 +24,6 @@ class Level;
class SceneBeginData
{
public:
/// <summary>
/// The joints to create after setup.
/// </summary>
@@ -57,7 +56,7 @@ typedef Dictionary<Guid, Actor*, HeapAllocation> ActorsLookup;
/// </summary>
API_CLASS(Abstract, NoSpawn) class FLAXENGINE_API SceneObject : public ScriptingObject, public ISerializable
{
DECLARE_SCRIPTING_TYPE_NO_SPAWN(SceneObject);
DECLARE_SCRIPTING_TYPE_NO_SPAWN(SceneObject);
friend PrefabInstanceData;
friend Actor;
friend Level;
@@ -78,7 +77,6 @@ public:
// - Destroy
protected:
Actor* _parent;
Guid _prefabID;
Guid _prefabObjectID;
@@ -90,14 +88,12 @@ protected:
SceneObject(const SpawnParams& params);
public:
/// <summary>
/// Finalizes an instance of the <see cref="SceneObject"/> class.
/// </summary>
~SceneObject();
public:
/// <summary>
/// Determines whether object is during play (spawned/loaded and fully initialized).
/// </summary>
@@ -162,7 +158,6 @@ public:
API_PROPERTY() virtual void SetOrderInParent(int32 index) = 0;
public:
/// <summary>
/// Gets a value indicating whether this object has a valid linkage to the prefab asset.
/// </summary>
@@ -211,7 +206,6 @@ public:
API_FUNCTION() String GetNamePath(Char separatorChar = '/') const;
public:
/// <summary>
/// Called after whole scene or local group of scene objects deserialization.
/// </summary>
@@ -234,7 +228,6 @@ public:
virtual void EndPlay() = 0;
public:
// [ISerializable]
void Serialize(SerializeStream& stream, const void* otherObj) override;
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;

View File

@@ -11,7 +11,6 @@
class FLAXENGINE_API SceneObjectsFactory
{
public:
struct PrefabInstance
{
Guid RootId;
@@ -60,7 +59,6 @@ public:
static Actor* CreateActor(int32 typeId, const Guid& id);
public:
struct PrefabSyncData
{
friend SceneObjectsFactory;
@@ -117,6 +115,5 @@ public:
static void SynchronizePrefabInstances(Context& context, PrefabSyncData& data);
private:
static void SynchronizeNewPrefabInstance(Context& context, PrefabSyncData& data, Prefab* prefab, Actor* actor, const Guid& prefabObjectId);
};

View File

@@ -9,7 +9,7 @@ Actor* SceneQuery::RaycastScene(const Ray& ray)
PROFILE_CPU();
#if SCENE_QUERIES_WITH_LOCK
ScopeLock lock(Level::ScenesLock);
ScopeLock lock(Level::ScenesLock);
#endif
Actor* target;
@@ -94,7 +94,7 @@ void SceneQuery::GetAllActors(Array<Actor*>& actors)
PROFILE_CPU();
#if SCENE_QUERIES_WITH_LOCK
ScopeLock lock(Level::ScenesLock);
ScopeLock lock(Level::ScenesLock);
#endif
for (int32 i = 0; i < Level::Scenes.Count(); i++)

View File

@@ -17,7 +17,6 @@
class FLAXENGINE_API SceneQuery
{
public:
/// <summary>
/// Try to find actor hit by the given ray
/// </summary>
@@ -26,7 +25,6 @@ public:
static Actor* RaycastScene(const Ray& ray);
public:
/// <summary>
/// Gets all scene objects from the actor into linear list. Appends them (without the given actor).
/// </summary>
@@ -55,7 +53,6 @@ public:
static void GetAllActors(Array<Actor*>& actors);
public:
/// <summary>
/// Execute custom action on actors tree.
/// Action should returns false to stop calling deeper.
@@ -67,7 +64,7 @@ public:
static void TreeExecute(Function<bool(Actor*, Params ...)>& action, Params ... args)
{
#if SCENE_QUERIES_WITH_LOCK
ScopeLock lock(Level::ScenesLock);
ScopeLock lock(Level::ScenesLock);
#endif
for (int32 i = 0; i < Level::Scenes.Count(); i++)

View File

@@ -12,9 +12,8 @@
/// </summary>
API_CLASS() class FLAXENGINE_API SpriteRender : public Actor
{
DECLARE_SCENE_OBJECT(SpriteRender);
DECLARE_SCENE_OBJECT(SpriteRender);
private:
Color _color;
Float2 _size;
SpriteHandle _sprite;
@@ -26,7 +25,6 @@ private:
int32 _sceneRenderingKey = -1;
public:
/// <summary>
/// Gets the size of the sprite.
/// </summary>
@@ -86,12 +84,10 @@ public:
DrawPass DrawModes = DrawPass::Default;
private:
void OnMaterialLoaded();
void SetImage();
public:
// [Actor]
bool HasContentLoaded() const override;
void Draw(RenderContext& renderContext) override;
@@ -101,7 +97,6 @@ public:
void OnEndPlay() override;
protected:
// [Actor]
void OnEnable() override;
void OnDisable() override;

View File

@@ -21,9 +21,8 @@
/// </summary>
API_CLASS() class FLAXENGINE_API TextRender : public Actor
{
DECLARE_SCENE_OBJECT(TextRender);
DECLARE_SCENE_OBJECT(TextRender);
private:
struct DrawChunk
{
TextRender* Actor;
@@ -55,7 +54,6 @@ private:
Array<DrawChunk, InlinedAllocation<8>> _drawChunks;
public:
/// <summary>
/// Gets the text.
/// </summary>
@@ -154,7 +152,6 @@ public:
#endif
private:
void Invalidate()
{
// Invalidate data
@@ -162,7 +159,6 @@ private:
}
public:
// [Actor]
bool HasContentLoaded() const override;
void Draw(RenderContext& renderContext) override;
@@ -175,7 +171,6 @@ public:
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;
protected:
// [Actor]
void OnEnable() override;
void OnDisable() override;

View File

@@ -9,9 +9,8 @@
/// </summary>
API_CLASS(Sealed, NoConstructor) class FLAXENGINE_API UICanvas : public Actor
{
DECLARE_SCENE_OBJECT(UICanvas);
DECLARE_SCENE_OBJECT(UICanvas);
public:
// [Actor]
#if USE_EDITOR
BoundingBox GetEditorBox() const override;
@@ -20,7 +19,6 @@ public:
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;
protected:
// [Actor]
void BeginPlay(SceneBeginData* data) final override;
void EndPlay() final override;

View File

@@ -9,7 +9,6 @@
class Crc
{
public:
// Helper lookup table with cached CRC values.
static uint32 CachedCRCTablesSB8[8][256];

View File

@@ -12,7 +12,6 @@
class Delaunay2D
{
public:
struct Triangle
{
int32 Indices[3];
@@ -125,7 +124,6 @@ public:
}
private:
struct Edge
{
int32 Indices[2];

View File

@@ -10,7 +10,6 @@
class FLAXENGINE_API Encryption
{
public:
/// <summary>
/// Encrypt bytes with custom data
/// </summary>
@@ -26,7 +25,6 @@ public:
static void DecryptBytes(byte* data, uint64 size);
public:
static int32 Base64EncodeLength(int32 size);
static int32 Base64DecodeLength(const char* encoded, int32 length);
static void Base64Encode(const byte* bytes, int32 size, Array<char>& encoded);

View File

@@ -24,7 +24,6 @@ class CaptureScreenshot : public ThreadPoolTask
{
friend Screenshot;
private:
TextureData _data;
GPUTextureReference _texture;
ScriptingObjectReference<RenderTask> _renderTask;
@@ -32,7 +31,6 @@ private:
DateTime _startTime;
public:
/// <summary>
/// Initializes a new instance of the <see cref="CaptureScreenshot"/> class.
/// </summary>
@@ -60,7 +58,6 @@ public:
}
public:
/// <summary>
/// Gets the texture data container.
/// </summary>
@@ -71,7 +68,6 @@ public:
}
protected:
// [ThreadPoolTask]
bool Run() override;
void OnFail() override;

View File

@@ -14,7 +14,7 @@ class GPUTexture;
/// </summary>
API_CLASS(Static) class FLAXENGINE_API Screenshot
{
DECLARE_SCRIPTING_TYPE_NO_SPAWN(Screenshot);
DECLARE_SCRIPTING_TYPE_NO_SPAWN(Screenshot);
/// <summary>
/// Captures the specified render target contents and saves it to the file.

View File

@@ -14,11 +14,9 @@ class FLAXENGINE_API State
friend StateMachine;
protected:
StateMachine* _parent;
protected:
/// <summary>
/// Init
/// </summary>
@@ -31,7 +29,6 @@ protected:
~State();
public:
/// <summary>
/// State's activity
/// </summary>
@@ -58,7 +55,6 @@ public:
}
protected:
virtual void enterState()
{
}
@@ -76,12 +72,10 @@ class FLAXENGINE_API StateMachine
friend State;
protected:
State* _currentState;
Array<State*> _states;
public:
/// <summary>
/// Init
/// </summary>
@@ -93,7 +87,6 @@ public:
virtual ~StateMachine();
public:
/// <summary>
/// Gets current state
/// </summary>
@@ -113,7 +106,6 @@ public:
}
public:
/// <summary>
/// Go to state
/// </summary>
@@ -130,6 +122,5 @@ public:
virtual void GoToState(State* state);
protected:
virtual void switchState(State* nextState);
};

View File

@@ -9,20 +9,17 @@ template<typename CharType, int InlinedSize = 128>
class StringAsBase
{
protected:
const CharType* _static = nullptr;
CharType* _dynamic = nullptr;
CharType _inlined[InlinedSize];
public:
~StringAsBase()
{
Allocator::Free(_dynamic);
}
public:
const CharType* Get() const
{
return _static ? _static : (_dynamic ? _dynamic : _inlined);
@@ -38,12 +35,10 @@ template<int InlinedSize = 128>
class StringAsANSI : public StringAsBase<char, InlinedSize>
{
public:
typedef char CharType;
typedef StringAsBase<CharType, InlinedSize> Base;
public:
StringAsANSI(const char* text)
{
this->_static = text;
@@ -74,12 +69,10 @@ template<int InlinedSize = 128>
class StringAsUTF8 : public StringAsBase<char, InlinedSize>
{
public:
typedef char CharType;
typedef StringAsBase<CharType, InlinedSize> Base;
public:
StringAsUTF8(const char* text)
{
this->_static = text;
@@ -110,12 +103,10 @@ template<int InlinedSize = 128>
class StringAsUTF16 : public StringAsBase<Char, InlinedSize>
{
public:
typedef Char CharType;
typedef StringAsBase<CharType, InlinedSize> Base;
public:
StringAsUTF16(const char* text)
: StringAsUTF16(text, StringUtils::Length(text))
{

View File

@@ -14,19 +14,16 @@
class FLAXENGINE_API TextProcessing : public NonCopyable
{
public:
/// <summary>
/// Separator structure
/// </summary>
struct SeparatorData
{
public:
char C0;
char C1;
public:
SeparatorData()
: C0(0)
, C1(0)
@@ -52,7 +49,6 @@ public:
}
public:
bool IsWhiteSpace() const
{
return *this == SeparatorData('\r', '\n')
@@ -62,7 +58,6 @@ public:
}
public:
bool operator==(const SeparatorData& other) const
{
return C0 == other.C0 && C1 == other.C1;
@@ -80,13 +75,11 @@ public:
struct Token
{
public:
const char* Start;
int32 Length;
SeparatorData Separator;
public:
Token()
: Start(nullptr)
, Length(0)
@@ -135,14 +128,12 @@ public:
}*/
public:
StringAnsi ToString() const
{
return StringAnsi(Start, Length);
}
public:
FORCE_INLINE bool Equals(const Token& other) const
{
return Equals(other.Start, other.Length);
@@ -159,7 +150,6 @@ public:
}
public:
FORCE_INLINE bool EqualsIgnoreCase(const Token& other) const
{
return EqualsIgnoreCase(other.Start, other.Length);
@@ -176,7 +166,6 @@ public:
}
public:
FORCE_INLINE bool operator==(const char* text) const
{
auto token = Token(text);
@@ -195,7 +184,6 @@ public:
};
private:
const char* _buffer;
int32 _length;
char* _cursor;
@@ -203,7 +191,6 @@ private:
int32 _line;
public:
/// <summary>
/// Init
/// </summary>
@@ -212,7 +199,6 @@ public:
TextProcessing(const char* input, int32 length);
public:
/// <summary>
/// Array with all token separators
/// </summary>
@@ -224,14 +210,12 @@ public:
Array<char> Whitespaces;
public:
/// <summary>
/// Set separators and white chars for HLSL language
/// </summary>
void Setup_HLSL();
public:
/// <summary>
/// Returns true if there are still characters in the buffer and can read data from it
/// </summary>
@@ -260,7 +244,6 @@ public:
}
public:
/// <summary>
/// Read single character from the buffer
/// </summary>
@@ -290,7 +273,6 @@ public:
void ReadLine();
private:
char moveForward();
char moveBack();
};

View File

@@ -15,11 +15,9 @@ template<typename CharType>
class TextWriter : public Object, public NonCopyable
{
private:
MemoryWriteStream _buffer;
public:
/// <summary>
/// Init with default capacity
/// </summary>
@@ -37,7 +35,6 @@ public:
}
public:
/// <summary>
/// Gets writer private buffer
/// </summary>
@@ -57,7 +54,6 @@ public:
}
public:
/// <summary>
/// Write line terminator sign
/// </summary>
@@ -139,7 +135,6 @@ public:
}
public:
/// <summary>
/// Clear whole data
/// </summary>
@@ -149,7 +144,6 @@ public:
}
public:
// [Object]
String ToString() const override
{

View File

@@ -23,14 +23,12 @@ template<class NodeType, class BoxType, class ParameterType>
class Graph
{
public:
typedef Graph<NodeType, BoxType, ParameterType> GraphType;
typedef NodeType Node;
typedef BoxType Box;
typedef ParameterType Parameter;
private:
struct TmpConnectionHint
{
Node* Node;
@@ -56,7 +54,6 @@ public:
VisjectMeta Meta;
public:
/// <summary>
/// Initializes a new instance of the <see cref="Graph"/> class.
/// </summary>
@@ -72,7 +69,6 @@ public:
}
public:
/// <summary>
/// Save graph to the stream
/// </summary>
@@ -456,7 +452,6 @@ public:
}
public:
/// <summary>
/// Find node by ID
/// </summary>
@@ -528,7 +523,6 @@ public:
}
public:
#if USE_EDITOR
/// <summary>
@@ -561,7 +555,6 @@ public:
#endif
protected:
virtual bool onNodeCreated(Node* n)
{
return false;

View File

@@ -19,7 +19,6 @@ class GraphNode;
class GraphBox
{
public:
/// <summary>
/// The parent node
/// </summary>
@@ -41,7 +40,6 @@ public:
Array<GraphBox*, InlinedAllocation<4>> Connections;
public:
GraphBox()
: Parent(nullptr)
, ID(0)
@@ -75,7 +73,6 @@ public:
}
public:
/// <summary>
/// Gets the parent node.
/// </summary>
@@ -101,12 +98,10 @@ template<class BoxType>
class GraphNode
{
public:
typedef BoxType Box;
typedef GraphNode<BoxType> Node;
public:
/// <summary>
/// Unique node ID (within a graph).
/// </summary>
@@ -139,7 +134,6 @@ public:
VisjectMeta Meta;
public:
GraphNode()
: ID(0)
, Type(0)
@@ -154,7 +148,6 @@ public:
}
public:
/// <summary>
/// Gets all the valid boxes.
/// </summary>

View File

@@ -41,9 +41,8 @@ API_ENUM() enum class ChannelMask
/// </summary>
API_CLASS() class FLAXENGINE_API GraphParameter : public ScriptingObject
{
DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(GraphParameter, ScriptingObject);
DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(GraphParameter, ScriptingObject);
public:
/// <summary>
/// Parameter type
/// </summary>
@@ -75,7 +74,6 @@ public:
VisjectMeta Meta;
public:
/// <summary>
/// Gets the typename of the parameter type (excluding in-build types).
/// </summary>

View File

@@ -64,7 +64,7 @@ void ShaderGenerator::ProcessGroupConstants(Box* box, Node* node, Value& value)
{
switch (node->TypeID)
{
// Constant value
// Constant value
case 1:
case 2:
case 3:
@@ -96,7 +96,7 @@ void ShaderGenerator::ProcessGroupConstants(Box* box, Node* node, Value& value)
value = Value::Zero;
break;
}
// PI
// PI
case 10:
{
value = Value(PI);
@@ -129,7 +129,7 @@ void ShaderGenerator::ProcessGroupMath(Box* box, Node* node, Value& value)
{
switch (node->TypeID)
{
// Add, Subtract, Multiply, Divide, Modulo
// Add, Subtract, Multiply, Divide, Modulo
case 1:
case 2:
case 3:
@@ -175,7 +175,7 @@ void ShaderGenerator::ProcessGroupMath(Box* box, Node* node, Value& value)
value = writeOperation2(node, v1, v2, op);
break;
}
// Absolute Value, Ceil, Cosine, Floor, Normalize, Round, Saturate, Sine, Sqrt, Tangent
// Absolute Value, Ceil, Cosine, Floor, Normalize, Round, Saturate, Sine, Sqrt, Tangent
case 7:
case 8:
case 9:
@@ -193,14 +193,14 @@ void ShaderGenerator::ProcessGroupMath(Box* box, Node* node, Value& value)
value = writeFunction1(node, v1, function);
break;
}
// Length
// Length
case 11:
{
String text = String::Format(TEXT("length({0})"), tryGetValue(node->GetBox(0), Value::Zero).Value);
value = writeLocal(ValueType::Float, text, node);
break;
}
// Cross, Max, Min, Pow
// Cross, Max, Min, Pow
case 18:
case 21:
case 22:
@@ -214,7 +214,7 @@ void ShaderGenerator::ProcessGroupMath(Box* box, Node* node, Value& value)
value = writeFunction2(node, v1, v2, function);
break;
}
// Distance, Dot
// Distance, Dot
case 19:
case 20:
{
@@ -226,7 +226,7 @@ void ShaderGenerator::ProcessGroupMath(Box* box, Node* node, Value& value)
value = writeFunction2(node, v1, v2, function, ValueType::Float);
break;
}
// Clamp
// Clamp
case 24:
{
Box* b1 = node->GetBox(0);
@@ -238,7 +238,7 @@ void ShaderGenerator::ProcessGroupMath(Box* box, Node* node, Value& value)
value = writeFunction3(node, v1, v2, v3, TEXT("clamp"), v1.Type);
break;
}
// Lerp
// Lerp
case 25:
{
Value a = tryGetValue(node->GetBox(0), 0, Value::Zero);
@@ -248,7 +248,7 @@ void ShaderGenerator::ProcessGroupMath(Box* box, Node* node, Value& value)
value = writeLocal(a.Type, text, node);
break;
}
// Reflect
// Reflect
case 26:
{
Box* b1 = node->GetBox(0);
@@ -259,7 +259,7 @@ void ShaderGenerator::ProcessGroupMath(Box* box, Node* node, Value& value)
value = writeFunction2(node, v1, v2, function);
break;
}
// Negate
// Negate
case 27:
{
Box* b1 = node->GetBox(0);
@@ -267,21 +267,21 @@ void ShaderGenerator::ProcessGroupMath(Box* box, Node* node, Value& value)
value = writeLocal(v1.Type, String(TEXT("-")) + v1.Value, node);
break;
}
// 1 - Value
// 1 - Value
case 28:
{
Value v1 = tryGetValue(node->GetBox(0), Value::Zero);
value = writeOperation2(node, Value::InitForOne(v1.Type), v1, '-');
break;
}
// Derive Normal Z
// Derive Normal Z
case 29:
{
Value inXY = tryGetValue(node->GetBox(0), Value::Zero).AsFloat2();
value = writeLocal(ValueType::Float3, String::Format(TEXT("float3({0}, sqrt(saturate(1.0 - dot({0}.xy, {0}.xy))))"), inXY.Value), node);
break;
}
// Mad
// Mad
case 31:
{
Value v1 = tryGetValue(node->GetBox(0), Value::Zero);
@@ -291,7 +291,7 @@ void ShaderGenerator::ProcessGroupMath(Box* box, Node* node, Value& value)
value = writeLocal(v1.Type, text, node);
break;
}
// Extract Largest Component
// Extract Largest Component
case 32:
{
Value v1 = tryGetValue(node->GetBox(0), Value::Zero);
@@ -300,25 +300,25 @@ void ShaderGenerator::ProcessGroupMath(Box* box, Node* node, Value& value)
_includes.Add(TEXT("./Flax/Math.hlsl"));
break;
}
// Asine
// Asine
case 33:
{
value = writeFunction1(node, tryGetValue(node->GetBox(0), Value::Zero), TEXT("asin"));
break;
}
// Acosine
// Acosine
case 34:
{
value = writeFunction1(node, tryGetValue(node->GetBox(0), Value::Zero), TEXT("acos"));
break;
}
// Atan
// Atan
case 35:
{
value = writeFunction1(node, tryGetValue(node->GetBox(0), Value::Zero), TEXT("atan"));
break;
}
// Bias and Scale
// Bias and Scale
case 36:
{
ASSERT(node->Values.Count() == 2 && node->Values[0].Type == VariantType::Float && node->Values[1].Type == VariantType::Float);
@@ -329,7 +329,7 @@ void ShaderGenerator::ProcessGroupMath(Box* box, Node* node, Value& value)
value = writeLocal(input.Type, text, node);
break;
}
// Rotate About Axis
// Rotate About Axis
case 37:
{
const auto normalizedRotationAxis = tryGetValue(node->GetBox(0), Value::Zero).AsFloat3();
@@ -341,19 +341,19 @@ void ShaderGenerator::ProcessGroupMath(Box* box, Node* node, Value& value)
value = writeLocal(ValueType::Float3, text, node);
break;
}
// Trunc
// Trunc
case 38:
{
value = writeFunction1(node, tryGetValue(node->GetBox(0), Value::Zero), TEXT("trunc"));
break;
}
// Frac
// Frac
case 39:
{
value = writeFunction1(node, tryGetValue(node->GetBox(0), Value::Zero), TEXT("frac"));
break;
}
// Fmod
// Fmod
case 40:
{
Value v1 = tryGetValue(node->GetBox(0), Value::Zero);
@@ -361,7 +361,7 @@ void ShaderGenerator::ProcessGroupMath(Box* box, Node* node, Value& value)
value = writeFunction2(node, v1, v2, TEXT("fmod"));
break;
}
// Atan2
// Atan2
case 41:
{
Value v1 = tryGetValue(node->GetBox(0), Value::Zero);
@@ -369,7 +369,7 @@ void ShaderGenerator::ProcessGroupMath(Box* box, Node* node, Value& value)
value = writeFunction2(node, v1, v2, TEXT("atan2"));
break;
}
// Near Equal
// Near Equal
case 42:
{
Value v1 = tryGetValue(node->GetBox(0), Value::Zero);
@@ -378,30 +378,30 @@ void ShaderGenerator::ProcessGroupMath(Box* box, Node* node, Value& value)
value = writeLocal(ValueType::Bool, String::Format(TEXT("distance({0},{1}) < {2}"), v1.Value, v2.Value, epsilon.Value), node);
break;
}
// Degrees
// Degrees
case 43:
{
value = writeFunction1(node, tryGetValue(node->GetBox(0), Value::Zero), TEXT("degrees"));
break;
}
// Radians
// Radians
case 44:
{
value = writeFunction1(node, tryGetValue(node->GetBox(0), Value::Zero), TEXT("radians"));
break;
}
// Remap
// Remap
case 48:
{
const auto inVal = tryGetValue(node->GetBox(0), node->Values[0].AsFloat);
const auto inVal = tryGetValue(node->GetBox(0), node->Values[0].AsFloat);
const auto rangeA = tryGetValue(node->GetBox(1), node->Values[1].AsFloat2());
const auto rangeB = tryGetValue(node->GetBox(2), node->Values[2].AsFloat2());
const auto clamp = tryGetValue(node->GetBox(3), node->Values[3]).AsBool();
const auto clamp = tryGetValue(node->GetBox(3), node->Values[3]).AsBool();
const auto mapFunc = String::Format(TEXT("{2}.x + ({0} - {1}.x) * ({2}.y - {2}.x) / ({1}.y - {1}.x)"), inVal.Value, rangeA.Value, rangeB.Value);
value = writeLocal(ValueType::Float, String::Format(TEXT("{2} ? clamp({0}, {1}.x, {1}.y) : {0}"), mapFunc, rangeB.Value, clamp.Value), node);
break;
}
// Rotate Vector
// Rotate Vector
case 49:
{
const Value quaternion = tryGetValue(node->GetBox(0), Value::InitForZero(VariantType::Quaternion)).Cast(VariantType::Quaternion);
@@ -418,7 +418,7 @@ void ShaderGenerator::ProcessGroupPacking(Box* box, Node* node, Value& value)
{
switch (node->TypeID)
{
// Pack
// Pack
case 20:
{
Box* bX = node->GetBox(1);
@@ -460,7 +460,7 @@ void ShaderGenerator::ProcessGroupPacking(Box* box, Node* node, Value& value)
value = Value::Zero;
break;
}
// Unpack
// Unpack
case 30:
{
Box* b = node->GetBox(0);
@@ -502,7 +502,7 @@ void ShaderGenerator::ProcessGroupPacking(Box* box, Node* node, Value& value)
value = Value::Zero;
break;
}
// Mask X, Y, Z, W
// Mask X, Y, Z, W
case 40:
case 41:
case 42:
@@ -512,7 +512,7 @@ void ShaderGenerator::ProcessGroupPacking(Box* box, Node* node, Value& value)
value = Value(ValueType::Float, v.Value + _subs[node->TypeID - 40]);
break;
}
// Mask XY, YZ, XZ,...
// Mask XY, YZ, XZ,...
case 44:
{
value = tryGetValue(node->GetBox(0), Float2::Zero).AsFloat2();
@@ -536,13 +536,13 @@ void ShaderGenerator::ProcessGroupPacking(Box* box, Node* node, Value& value)
value = Value(ValueType::Float2, v.Value + TEXT(".zw"));
break;
}
// Mask XYZ
// Mask XYZ
case 70:
{
value = tryGetValue(node->GetBox(0), Float4::Zero).AsFloat3();
break;
}
// Append
// Append
case 100:
{
auto in0 = node->GetBox(0);
@@ -586,7 +586,7 @@ void ShaderGenerator::ProcessGroupTools(Box* box, Node* node, Value& value)
{
switch (node->TypeID)
{
// Desaturation
// Desaturation
case 2:
{
Value input = tryGetValue(node->GetBox(0), Value::Zero).AsFloat3();
@@ -596,7 +596,7 @@ void ShaderGenerator::ProcessGroupTools(Box* box, Node* node, Value& value)
value = writeFunction3(node, input, dot, scale, TEXT("lerp"), ValueType::Float3);
break;
}
// Color Gradient
// Color Gradient
case 10:
{
Value time, prevTime, curTime;
@@ -661,7 +661,7 @@ void ShaderGenerator::ProcessGroupTools(Box* box, Node* node, Value& value)
}
break;
}
// Curve
// Curve
#define SAMPLE_CURVE(id, curves, type, graphType) \
case id: \
{ \
@@ -675,7 +675,7 @@ void ShaderGenerator::ProcessGroupTools(Box* box, Node* node, Value& value)
SAMPLE_CURVE(14, Float3Curves, AsFloat3, Float3)
SAMPLE_CURVE(15, Float4Curves, AsFloat4, Float4)
#undef SETUP_CURVE
// Get Gameplay Global
// Get Gameplay Global
case 16:
{
// Get the variable type
@@ -723,7 +723,7 @@ void ShaderGenerator::ProcessGroupTools(Box* box, Node* node, Value& value)
value.Value = param->ShaderName;
break;
}
// Platform Switch
// Platform Switch
case 17:
{
bool usesAnyPlatformSpecificInput = false;
@@ -768,7 +768,7 @@ void ShaderGenerator::ProcessGroupTools(Box* box, Node* node, Value& value)
#undef PLATFORM_CASE
break;
}
// Reroute
// Reroute
case 29:
value = tryGetValue(node->GetBox(0), Value::Zero);
break;
@@ -781,7 +781,7 @@ void ShaderGenerator::ProcessGroupBoolean(Box* box, Node* node, Value& value)
{
switch (node->TypeID)
{
// NOT
// NOT
case 1:
{
// Get A value
@@ -791,7 +791,7 @@ void ShaderGenerator::ProcessGroupBoolean(Box* box, Node* node, Value& value)
value = writeLocal(ValueType::Bool, String::Format(TEXT("!{0}"), a.Value), node);
break;
}
// AND, OR, XOR, NOR, NAND
// AND, OR, XOR, NOR, NAND
case 2:
case 3:
case 4:
@@ -806,28 +806,28 @@ void ShaderGenerator::ProcessGroupBoolean(Box* box, Node* node, Value& value)
const Char* op;
switch (node->TypeID)
{
// AND
// AND
case 2:
op = TEXT("{0} && {1}");
break;
// OR
// OR
case 3:
op = TEXT("{0} || {1}");
break;
// XOR
// XOR
case 4:
op = TEXT("!{0} != !{1}");
break;
// NOR
// NOR
case 5:
op = TEXT("!({0} || {1})");
break;
// NAND
// NAND
case 6:
op = TEXT("!({0} && {1})");
break;
default:
CRASH;
CRASH;
return;
}
value = writeLocal(ValueType::Bool, String::Format(op, a.Value, b.Value), node);
@@ -842,7 +842,7 @@ void ShaderGenerator::ProcessGroupBitwise(Box* box, Node* node, Value& value)
{
switch (node->TypeID)
{
// NOT
// NOT
case 1:
{
// Get A value
@@ -852,7 +852,7 @@ void ShaderGenerator::ProcessGroupBitwise(Box* box, Node* node, Value& value)
value = writeLocal(ValueType::Int, String::Format(TEXT("!{0}"), a.Value), node);
break;
}
// AND, OR, XOR
// AND, OR, XOR
case 2:
case 3:
case 4:
@@ -865,20 +865,20 @@ void ShaderGenerator::ProcessGroupBitwise(Box* box, Node* node, Value& value)
const Char* op;
switch (node->TypeID)
{
// AND
// AND
case 2:
op = TEXT("{0} & {1}");
break;
// OR
// OR
case 3:
op = TEXT("{0} | {1}");
break;
// XOR
// XOR
case 4:
op = TEXT("{0} ^ {1}");
break;
default:
CRASH;
CRASH;
return;
}
value = writeLocal(ValueType::Int, String::Format(op, a.Value, b.Value), node);
@@ -893,7 +893,7 @@ void ShaderGenerator::ProcessGroupComparisons(Box* box, Node* node, Value& value
{
switch (node->TypeID)
{
// ==, !=, >, <=, >=
// ==, !=, >, <=, >=
case 1:
case 2:
case 3:
@@ -928,13 +928,13 @@ void ShaderGenerator::ProcessGroupComparisons(Box* box, Node* node, Value& value
op = TEXT("{0} >= {1}");
break;
default:
CRASH;
CRASH;
return;
}
value = writeLocal(ValueType::Bool, String::Format(op, a.Value, b.Value), node);
break;
}
// Switch On Bool
// Switch On Bool
case 7:
{
const Value condition = tryGetValue(node->GetBox(0), Value::False).AsBool();
@@ -1114,7 +1114,7 @@ ShaderGenerator::Value ShaderGenerator::writeLocal(ValueType type, const String&
ShaderGenerator::Value ShaderGenerator::writeOperation2(Node* caller, const Value& valueA, const Value& valueB, Char op1)
{
const Char op1Str[2] = { op1, 0};
const Char op1Str[2] = { op1, 0 };
const String value = String::Format(TEXT("{0} {1} {2}"), valueA.Value, op1Str, Value::Cast(valueB, valueA.Type).Value);
return writeLocal(valueA.Type, value, caller);
}

View File

@@ -23,14 +23,12 @@ class ShaderGraphNode;
class ShaderGraphBox : public GraphBox
{
public:
/// <summary>
/// The cached value.
/// </summary>
ShaderGraphValue Cache;
public:
ShaderGraphBox()
: GraphBox()
{
@@ -47,7 +45,6 @@ public:
}
public:
FORCE_INLINE ShaderGraphBox* FirstConnection() const
{
return (ShaderGraphBox*)Connections[0];
@@ -58,7 +55,6 @@ template<class BoxType = ShaderGraphBox>
class ShaderGraphNode : public GraphNode<BoxType>
{
public:
struct CurveData
{
/// <summary>
@@ -79,14 +75,12 @@ public:
};
public:
ShaderGraphNode()
: GraphNode<ShaderGraphBox>()
{
}
public:
/// <summary>
/// The custom data (depends on node type). Used to cache data for faster usage at runtime.
/// </summary>
@@ -96,7 +90,6 @@ public:
class ShaderGraphParameter : public GraphParameter
{
public:
ShaderGraphParameter()
: GraphParameter(SpawnParams(Guid::New(), TypeInitializer))
{
@@ -123,12 +116,10 @@ template<class NodeType = ShaderGraphNode<>, class BoxType = ShaderGraphBox, cla
class ShaderGraph : public Graph<NodeType, BoxType, ParameterType>
{
public:
typedef ShaderGraphValue Value;
typedef Graph<NodeType, BoxType, ParameterType> Base;
public:
/// <summary>
/// The float curves used by the graph.
/// </summary>
@@ -150,18 +141,17 @@ public:
Array<BezierCurve<Float4>> Float4Curves;
public:
// [Graph]
bool onNodeLoaded(NodeType* n) override
{
// Check if this node needs a state or data cache
switch (n->GroupID)
{
// Tools
// Tools
case 7:
switch (n->TypeID)
{
// Curves
// Curves
#define SETUP_CURVE(id, curves, access) \
case id: \
{ \
@@ -201,7 +191,6 @@ public:
class ShaderGenerator
{
public:
typedef ShaderGraph<> Graph;
typedef ShaderGraph<>::Node Node;
typedef ShaderGraph<>::Box Box;
@@ -212,7 +201,6 @@ public:
typedef Function<void(Box*, Node*, Value&)> ProcessBoxHandler;
protected:
int32 _localIndex;
Dictionary<Node*, Graph*> _functions;
Array<SerializedMaterialParam> _parameters;
@@ -223,7 +211,6 @@ protected:
Array<Graph*, FixedAllocation<32>> _graphStack;
public:
/// <summary>
/// Initializes a new instance of the <see cref="ShaderGenerator"/> class.
/// </summary>
@@ -235,7 +222,6 @@ public:
~ShaderGenerator();
public:
ErrorHandler Error;
/// <summary>
@@ -244,7 +230,6 @@ public:
AssetsContainer Assets;
public:
void OnError(Node* node, Box* box, const StringView& message);
void ProcessGroupConstants(Box* box, Node* node, Value& value);
@@ -256,12 +241,10 @@ public:
void ProcessGroupComparisons(Box* box, Node* node, Value& value);
protected:
static const Char* _mathFunctions[];
static const Char* _subs[];
protected:
Value eatBox(Node* caller, Box* box);
Value tryGetValue(Box* box, int32 defaultValueBoxIndex, const Value& defaultValue);
Value tryGetValue(Box* box, const Value& defaultValue);

View File

@@ -12,11 +12,9 @@
struct ShaderGraphValue : Object
{
private:
static const Char* _subs[];
public:
/// <summary>
/// The value type.
/// </summary>
@@ -28,7 +26,6 @@ public:
String Value;
public:
/// <summary>
/// Zero value (as float).
/// </summary>
@@ -55,7 +52,6 @@ public:
static const ShaderGraphValue False;
public:
/// <summary>
/// Initializes a new instance of the <see cref="ShaderGraphValue"/> struct.
/// </summary>
@@ -134,7 +130,6 @@ public:
explicit ShaderGraphValue(const Variant& v);
public:
/// <summary>
/// Returns true if value is valid.
/// </summary>
@@ -175,7 +170,6 @@ public:
}
public:
/// <summary>
/// Formats thw value.
/// </summary>
@@ -227,7 +221,6 @@ public:
}
public:
/// <summary>
/// Initializes the shader variable for given connection type Zero.
/// </summary>
@@ -301,7 +294,6 @@ public:
}
public:
/// <summary>
/// Gets the X component of the value. Valid only for single or vector types.
/// </summary>
@@ -339,7 +331,6 @@ public:
}
public:
/// <summary>
/// Casts the value to the bool type.
/// </summary>
@@ -422,7 +413,6 @@ public:
static ShaderGraphValue Cast(const ShaderGraphValue& v, VariantType::Types to);
public:
// [Object]
String ToString() const override
{

View File

@@ -51,7 +51,7 @@ void VisjectExecutor::ProcessGroupConstants(Box* box, Node* node, Value& value)
{
switch (node->TypeID)
{
// Constant value
// Constant value
case 1:
case 2:
case 3:
@@ -89,15 +89,15 @@ void VisjectExecutor::ProcessGroupConstants(Box* box, Node* node, Value& value)
case 9:
value = node->Values[0];
break;
// PI
// PI
case 10:
value = PI;
break;
// Enum
// Enum
case 11:
value = node->Values[0];
break;
// Array
// Array
case 13:
value = node->Values[0];
if (value.Type.Type == VariantType::Array)
@@ -152,7 +152,7 @@ void VisjectExecutor::ProcessGroupMath(Box* box, Node* node, Value& value)
{
switch (node->TypeID)
{
// Add, Subtract, Multiply, Divide, Modulo, Max, Min, Pow, Fmod, Atan2
// Add, Subtract, Multiply, Divide, Modulo, Max, Min, Pow, Fmod, Atan2
case 1:
case 2:
case 3:
@@ -174,7 +174,7 @@ void VisjectExecutor::ProcessGroupMath(Box* box, Node* node, Value& value)
GraphUtilities::ApplySomeMathHere(node->TypeID, value, v1, v2);
break;
}
// Absolute Value, Ceil, Cosine, Floor, Round, Saturate, Sine, Sqrt, Tangent, Negate, 1 - Value, Asine, Acosine, Atan, Trunc, Frac, Degrees, Radians
// Absolute Value, Ceil, Cosine, Floor, Round, Saturate, Sine, Sqrt, Tangent, Negate, 1 - Value, Asine, Acosine, Atan, Trunc, Frac, Degrees, Radians
case 7:
case 8:
case 9:
@@ -198,7 +198,7 @@ void VisjectExecutor::ProcessGroupMath(Box* box, Node* node, Value& value)
GraphUtilities::ApplySomeMathHere(node->TypeID, value, v1);
break;
}
// Length, Normalize
// Length, Normalize
case 11:
case 12:
{
@@ -269,7 +269,7 @@ void VisjectExecutor::ProcessGroupMath(Box* box, Node* node, Value& value)
}
break;
}
// Cross, Distance, Dot
// Cross, Distance, Dot
case 18:
case 19:
case 20:
@@ -346,7 +346,7 @@ void VisjectExecutor::ProcessGroupMath(Box* box, Node* node, Value& value)
}
break;
}
// Clamp
// Clamp
case 24:
{
Value v1 = tryGetValue(node->GetBox(0), Value::Zero);
@@ -358,7 +358,7 @@ void VisjectExecutor::ProcessGroupMath(Box* box, Node* node, Value& value)
});
break;
}
// Lerp
// Lerp
case 25:
{
Value a = tryGetValue(node->GetBox(0), 0, Value::Zero);
@@ -367,7 +367,7 @@ void VisjectExecutor::ProcessGroupMath(Box* box, Node* node, Value& value)
value = Value::Lerp(a, b, alpha.AsFloat);
break;
}
// Reflect
// Reflect
case 26:
{
Value v1 = tryGetValue(node->GetBox(0), Value::Zero);
@@ -388,7 +388,7 @@ void VisjectExecutor::ProcessGroupMath(Box* box, Node* node, Value& value)
}
break;
}
// Mad
// Mad
case 31:
{
Value v1 = tryGetValue(node->GetBox(0), Value::Zero);
@@ -400,14 +400,14 @@ void VisjectExecutor::ProcessGroupMath(Box* box, Node* node, Value& value)
});
break;
}
// Extract Largest Component
// Extract Largest Component
case 32:
{
const auto v1 = (Float3)tryGetValue(node->GetBox(0), Value::Zero);
value = Math::ExtractLargestComponent(v1);
break;
}
// Bias and Scale
// Bias and Scale
case 36:
{
ASSERT(node->Values.Count() == 2 && node->Values[0].Type == VariantType::Float && node->Values[1].Type == VariantType::Float);
@@ -417,7 +417,7 @@ void VisjectExecutor::ProcessGroupMath(Box* box, Node* node, Value& value)
value = (input + bias) * scale;
break;
}
// Rotate About Axis
// Rotate About Axis
case 37:
{
const auto normalizedRotationAxis = (Float3)tryGetValue(node->GetBox(0), Value::Zero);
@@ -427,7 +427,7 @@ void VisjectExecutor::ProcessGroupMath(Box* box, Node* node, Value& value)
value = Math::RotateAboutAxis(normalizedRotationAxis, rotationAngle, pivotPoint, position);
break;
}
// Near Equal
// Near Equal
case 42:
{
const Value a = tryGetValue(node->GetBox(0), node->Values[0]);
@@ -436,23 +436,23 @@ void VisjectExecutor::ProcessGroupMath(Box* box, Node* node, Value& value)
value = Value::NearEqual(a, b, epsilon);
break;
}
// Enum Value
// Enum Value
case 45:
value = (uint64)tryGetValue(node->GetBox(0), Value::Zero);
break;
// Enum AND
// Enum AND
case 46:
value = tryGetValue(node->GetBox(0), Value::Zero);
if (value.Type.Type == VariantType::Enum)
value.AsUint64 = value.AsUint64 & (uint64)tryGetValue(node->GetBox(1), Value::Zero);
break;
// Enum OR
// Enum OR
case 47:
value = tryGetValue(node->GetBox(0), Value::Zero);
if (value.Type.Type == VariantType::Enum)
value.AsUint64 = value.AsUint64 | (uint64)tryGetValue(node->GetBox(1), Value::Zero);
break;
// Remap
// Remap
case 48:
{
const float inVal = tryGetValue(node->GetBox(0), node->Values[0]).AsFloat;
@@ -463,7 +463,7 @@ void VisjectExecutor::ProcessGroupMath(Box* box, Node* node, Value& value)
value = clamp ? Math::Clamp(mapFunc, rangeB.X, rangeB.Y) : mapFunc;
break;
}
// Rotate Vector
// Rotate Vector
case 49:
{
const Quaternion quaternion = (Quaternion)tryGetValue(node->GetBox(0), Quaternion::Identity);
@@ -480,7 +480,7 @@ void VisjectExecutor::ProcessGroupPacking(Box* box, Node* node, Value& value)
{
switch (node->TypeID)
{
// Pack
// Pack
case 20:
{
float vX = (float)tryGetValue(node->GetBox(1), node->Values[0]);
@@ -528,7 +528,7 @@ void VisjectExecutor::ProcessGroupPacking(Box* box, Node* node, Value& value)
value = Variant(BoundingBox(vX, vY));
break;
}
// Unpack
// Unpack
case 30:
{
Float2 v = (Float2)tryGetValue(node->GetBox(0), Float2::Zero);
@@ -592,7 +592,7 @@ void VisjectExecutor::ProcessGroupPacking(Box* box, Node* node, Value& value)
}
break;
}
// Pack Structure
// Pack Structure
case 26:
{
// Find type
@@ -675,7 +675,7 @@ void VisjectExecutor::ProcessGroupPacking(Box* box, Node* node, Value& value)
}
break;
}
// Unpack Structure
// Unpack Structure
case 36:
{
// Get value with structure data
@@ -765,7 +765,7 @@ void VisjectExecutor::ProcessGroupPacking(Box* box, Node* node, Value& value)
}
break;
}
// Mask X, Y, Z, W
// Mask X, Y, Z, W
case 40:
case 41:
case 42:
@@ -775,7 +775,7 @@ void VisjectExecutor::ProcessGroupPacking(Box* box, Node* node, Value& value)
value = v.Raw[node->TypeID - 40];
break;
}
// Mask XY, YZ, XZ,...
// Mask XY, YZ, XZ,...
case 44:
{
value = (Float2)tryGetValue(node->GetBox(0), Float2::Zero);
@@ -799,13 +799,13 @@ void VisjectExecutor::ProcessGroupPacking(Box* box, Node* node, Value& value)
value = Float2(v.Z, v.W);
break;
}
// Mask XYZ
// Mask XYZ
case 70:
{
value = (Float3)tryGetValue(node->GetBox(0), Float3::Zero);
break;
}
// Append
// Append
case 100:
{
auto in0 = node->GetBox(0);
@@ -860,7 +860,7 @@ void VisjectExecutor::ProcessGroupTools(Box* box, Node* node, Value& value)
{
switch (node->TypeID)
{
// Color Gradient
// Color Gradient
case 10:
{
float time, prevTime, curTime;
@@ -916,7 +916,7 @@ void VisjectExecutor::ProcessGroupTools(Box* box, Node* node, Value& value)
}
break;
}
// Curve
// Curve
#define SAMPLE_CURVE(id, curves, type, graphType) \
case id: \
{ \
@@ -931,7 +931,7 @@ void VisjectExecutor::ProcessGroupTools(Box* box, Node* node, Value& value)
SAMPLE_CURVE(14, Float3Curves, Float3, Float3)
SAMPLE_CURVE(15, Float4Curves, Float4, Float4)
#undef SETUP_CURVE
// Get Gameplay Global
// Get Gameplay Global
case 16:
if (const auto asset = node->Assets[0].As<GameplayGlobals>())
{
@@ -944,7 +944,7 @@ void VisjectExecutor::ProcessGroupTools(Box* box, Node* node, Value& value)
value = Value::Zero;
}
break;
// Platform Switch
// Platform Switch
case 17:
{
int32 boxId = 1;
@@ -985,19 +985,19 @@ void VisjectExecutor::ProcessGroupTools(Box* box, Node* node, Value& value)
value = tryGetValue(node->GetBox(node->GetBox(boxId)->HasConnection() ? boxId : 1), Value::Zero);
break;
}
// Asset Reference
// Asset Reference
case 18:
value = ::LoadAsset((Guid)node->Values[0], Asset::TypeInitializer);
break;
// To String
// To String
case 20:
value.SetString(tryGetValue(node->GetBox(1), Value(StringView::Empty)).ToString());
break;
// Actor Reference
// Actor Reference
case 21:
value = Scripting::FindObject<Actor>((Guid)node->Values[0]);
break;
// As
// As
case 22:
{
value = Value::Null;
@@ -1013,7 +1013,7 @@ void VisjectExecutor::ProcessGroupTools(Box* box, Node* node, Value& value)
}
break;
}
// Type Reference node
// Type Reference node
case 23:
{
const StringView typeName(node->Values[0]);
@@ -1023,7 +1023,7 @@ void VisjectExecutor::ProcessGroupTools(Box* box, Node* node, Value& value)
value = typeName;
break;
}
// Is
// Is
case 24:
{
value = Value::False;
@@ -1038,15 +1038,15 @@ void VisjectExecutor::ProcessGroupTools(Box* box, Node* node, Value& value)
}
break;
}
// Is Null
// Is Null
case 27:
value = (void*)tryGetValue(node->GetBox(1), Value::Null) == nullptr;
break;
// Is Valid
// Is Valid
case 28:
value = (void*)tryGetValue(node->GetBox(1), Value::Null) != nullptr;
break;
// Reroute
// Reroute
case 29:
value = tryGetValue(node->GetBox(0), Value::Zero);
break;
@@ -1059,14 +1059,14 @@ void VisjectExecutor::ProcessGroupBoolean(Box* box, Node* node, Value& value)
{
switch (node->TypeID)
{
// NOT
// NOT
case 1:
{
const bool a = (bool)tryGetValue(node->GetBox(0), Value::False);
value = !a;
break;
}
// AND, OR, XOR, NOR, NAND
// AND, OR, XOR, NOR, NAND
case 2:
case 3:
case 4:
@@ -1078,23 +1078,23 @@ void VisjectExecutor::ProcessGroupBoolean(Box* box, Node* node, Value& value)
bool result = false;
switch (node->TypeID)
{
// AND
// AND
case 2:
result = a && b;
break;
// OR
// OR
case 3:
result = a || b;
break;
// XOR
// XOR
case 4:
result = !a != !b;
break;
// NOR
// NOR
case 5:
result = !(a || b);
break;
// NAND
// NAND
case 6:
result = !(a && b);
break;
@@ -1111,14 +1111,14 @@ void VisjectExecutor::ProcessGroupBitwise(Box* box, Node* node, Value& value)
{
switch (node->TypeID)
{
// NOT
// NOT
case 1:
{
const int32 a = (int32)tryGetValue(node->GetBox(0), Value(0));
value = !a;
break;
}
// AND, OR, XOR
// AND, OR, XOR
case 2:
case 3:
case 4:
@@ -1128,15 +1128,15 @@ void VisjectExecutor::ProcessGroupBitwise(Box* box, Node* node, Value& value)
int32 result = 0;
switch (node->TypeID)
{
// AND
// AND
case 2:
result = a & b;
break;
// OR
// OR
case 3:
result = a | b;
break;
// XOR
// XOR
case 4:
result = a ^ b;
break;
@@ -1153,7 +1153,7 @@ void VisjectExecutor::ProcessGroupComparisons(Box* box, Node* node, Value& value
{
switch (node->TypeID)
{
// ==, !=, >, <=, >=
// ==, !=, >, <=, >=
case 1:
case 2:
case 3:
@@ -1188,7 +1188,7 @@ void VisjectExecutor::ProcessGroupComparisons(Box* box, Node* node, Value& value
value = result;
break;
}
// Switch On Bool
// Switch On Bool
case 7:
{
const Value condition = tryGetValue(node->GetBox(0), Value::False);
@@ -1198,7 +1198,7 @@ void VisjectExecutor::ProcessGroupComparisons(Box* box, Node* node, Value& value
value = tryGetValue(node->GetBox(1), 0, Value::Zero);
break;
}
// Switch On Enum
// Switch On Enum
case 8:
{
const Value v = tryGetValue(node->GetBox(0), Value::Null);
@@ -1227,31 +1227,31 @@ void VisjectExecutor::ProcessGroupParticles(Box* box, Node* node, Value& value)
{
switch (node->TypeID)
{
// Random Float
// Random Float
case 208:
{
value = RAND;
break;
}
// Random Vector2
// Random Vector2
case 209:
{
value = Float2(RAND, RAND);
break;
}
// Random Vector3
// Random Vector3
case 210:
{
value = Float3(RAND, RAND, RAND);
break;
}
// Random Vector4
// Random Vector4
case 211:
{
value = Float4(RAND, RAND, RAND, RAND);
break;
}
// Random Float Range
// Random Float Range
case 213:
{
auto& a = node->Values[0].AsFloat;
@@ -1259,7 +1259,7 @@ void VisjectExecutor::ProcessGroupParticles(Box* box, Node* node, Value& value)
value = Math::Lerp(a, b, RAND);
break;
}
// Random Vector2 Range
// Random Vector2 Range
case 214:
{
auto a = (Float2)node->Values[0];
@@ -1270,7 +1270,7 @@ void VisjectExecutor::ProcessGroupParticles(Box* box, Node* node, Value& value)
);
break;
}
// Random Vector3 Range
// Random Vector3 Range
case 215:
{
auto a = (Float3)node->Values[0];
@@ -1282,7 +1282,7 @@ void VisjectExecutor::ProcessGroupParticles(Box* box, Node* node, Value& value)
);
break;
}
// Random Vector4 Range
// Random Vector4 Range
case 216:
{
auto a = (Float4)node->Values[0];
@@ -1313,39 +1313,39 @@ void VisjectExecutor::ProcessGroupCollections(Box* box, Node* node, Value& value
Box* b;
switch (node->TypeID)
{
// Count
// Count
case 1:
value = array.Count();
break;
// Contains
// Contains
case 2:
value = array.Contains(tryGetValue(node->GetBox(1), Value::Null));
break;
// Find
// Find
case 3:
b = node->GetBox(1);
ENSURE(b->HasConnection(), TEXT("Missing value to find."));
value = array.Find(eatBox(b->GetParent<Node>(), b->FirstConnection()));
break;
// Find Last
// Find Last
case 4:
b = node->GetBox(1);
ENSURE(b->HasConnection(), TEXT("Missing value to find."));
value = array.FindLast(eatBox(b->GetParent<Node>(), b->FirstConnection()));
break;
// Clear
// Clear
case 5:
array.Clear();
value = MoveTemp(v);
break;
// Remove
// Remove
case 6:
b = node->GetBox(1);
ENSURE(b->HasConnection(), TEXT("Missing value to remove."));
array.Remove(eatBox(b->GetParent<Node>(), b->FirstConnection()));
value = MoveTemp(v);
break;
// Remove At
// Remove At
case 7:
{
const int32 index = (int32)tryGetValue(node->GetBox(1), 0, Value::Null);
@@ -1354,14 +1354,14 @@ void VisjectExecutor::ProcessGroupCollections(Box* box, Node* node, Value& value
value = MoveTemp(v);
break;
}
// Add
// Add
case 8:
b = node->GetBox(1);
ENSURE(b->HasConnection(), TEXT("Missing value to add."));
array.Add(eatBox(b->GetParent<Node>(), b->FirstConnection()));
value = MoveTemp(v);
break;
// Insert
// Insert
case 9:
{
b = node->GetBox(1);
@@ -1372,7 +1372,7 @@ void VisjectExecutor::ProcessGroupCollections(Box* box, Node* node, Value& value
value = MoveTemp(v);
break;
}
// Get
// Get
case 10:
{
const int32 index = (int32)tryGetValue(node->GetBox(1), 0, Value::Null);
@@ -1380,7 +1380,7 @@ void VisjectExecutor::ProcessGroupCollections(Box* box, Node* node, Value& value
value = MoveTemp(array[index]);
break;
}
// Set
// Set
case 11:
{
b = node->GetBox(2);
@@ -1391,17 +1391,17 @@ void VisjectExecutor::ProcessGroupCollections(Box* box, Node* node, Value& value
value = MoveTemp(v);
break;
}
// Sort
// Sort
case 12:
Sorting::QuickSort(array.Get(), array.Count());
value = MoveTemp(v);
break;
// Reverse
// Reverse
case 13:
array.Reverse();
value = MoveTemp(v);
break;
// Add Unique
// Add Unique
case 14:
b = node->GetBox(1);
ENSURE(b->HasConnection(), TEXT("Missing value to add."));

View File

@@ -19,7 +19,6 @@ class VisjectGraphNode;
class VisjectGraphBox : public GraphBox
{
public:
VisjectGraphBox()
: GraphBox()
{
@@ -45,7 +44,6 @@ template<class BoxType = VisjectGraphBox>
class VisjectGraphNode : public GraphNode<BoxType>
{
public:
struct CurveData
{
/// <summary>
@@ -82,14 +80,12 @@ public:
};
public:
VisjectGraphNode()
: GraphNode<BoxType>()
{
}
public:
/// <summary>
/// The custom data (depends on node type). Used to cache data for faster usage at runtime.
/// </summary>
@@ -107,9 +103,8 @@ public:
/// <seealso cref="GraphParameter" />
API_CLASS() class VisjectGraphParameter : public GraphParameter
{
DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(VisjectGraphParameter, GraphParameter);
DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(VisjectGraphParameter, GraphParameter);
public:
VisjectGraphParameter(const VisjectGraphParameter& other)
: VisjectGraphParameter()
{
@@ -136,7 +131,6 @@ public:
typedef Graph<NodeType, BoxType, ParameterType> Base;
public:
/// <summary>
/// The float curves used by the graph.
/// </summary>
@@ -158,17 +152,16 @@ public:
Array<BezierCurve<Float4>> Float4Curves;
public:
// [Graph]
bool onNodeLoaded(NodeType* n) override
{
switch (n->GroupID)
{
// Tools
// Tools
case 7:
switch (n->TypeID)
{
// Curves
// Curves
#define SETUP_CURVE(id, curves, access) \
case id: \
{ \
@@ -193,7 +186,7 @@ public:
SETUP_CURVE(14, Float3Curves, AsFloat3())
SETUP_CURVE(15, Float4Curves, AsFloat4())
#undef SETUP_CURVE
// Get Gameplay Global
// Get Gameplay Global
case 16:
{
n->Assets[0] = ::LoadAsset((Guid)n->Values[0], Asset::TypeInitializer);
@@ -223,11 +216,9 @@ public:
typedef void (VisjectExecutor::*ProcessBoxHandler)(Box*, Node*, Value&);
protected:
ProcessBoxHandler _perGroupProcessCall[19];
public:
/// <summary>
/// Initializes a new instance of the <see cref="VisjectExecutor"/> class.
/// </summary>
@@ -239,11 +230,9 @@ public:
~VisjectExecutor();
public:
ErrorHandler Error;
public:
virtual void OnError(Node* node, Box* box, const StringView& message);
void ProcessGroupConstants(Box* box, Node* node, Value& value);
@@ -257,7 +246,6 @@ public:
void ProcessGroupCollections(Box* box, Node* node, Value& value);
protected:
virtual Value eatBox(Node* caller, Box* box) = 0;
virtual Graph* GetCurrentGraph() const = 0;

View File

@@ -11,7 +11,6 @@
class VisjectMeta
{
public:
/// <summary>
/// Metadata entry
/// </summary>
@@ -23,14 +22,12 @@ public:
};
public:
/// <summary>
/// All meta entries
/// </summary>
Array<Entry, FixedAllocation<8>> Entries;
public:
/// <summary>
/// Initializes a new instance of the <see cref="VisjectMeta"/> class.
/// </summary>
@@ -44,7 +41,6 @@ public:
}
public:
/// <summary>
/// Load from the stream
/// </summary>