implemented basic shader expressions
This commit is contained in:
@@ -44,11 +44,35 @@ void ArchiveBuffer::readFromStream(std::istream& stream)
|
||||
stream.read((char*)memory.data(), bufferLength);
|
||||
}
|
||||
|
||||
void ArchiveBuffer::seek(int64 s, SeekOp op)
|
||||
{
|
||||
int64 newPos = position;
|
||||
switch (op)
|
||||
{
|
||||
case SeekOp::BEGIN:
|
||||
newPos = s;
|
||||
break;
|
||||
case SeekOp::END:
|
||||
newPos = memory.size() + s;
|
||||
break;
|
||||
case SeekOp::CURRENT:
|
||||
newPos = position + s;
|
||||
break;
|
||||
}
|
||||
assert(newPos >= 0 && newPos < memory.size());
|
||||
newPos = position;
|
||||
}
|
||||
|
||||
bool ArchiveBuffer::eof() const
|
||||
{
|
||||
return position == memory.size();
|
||||
}
|
||||
|
||||
size_t Seele::ArchiveBuffer::size() const
|
||||
{
|
||||
return memory.size();
|
||||
}
|
||||
|
||||
void ArchiveBuffer::rewind()
|
||||
{
|
||||
position = 0;
|
||||
|
||||
@@ -16,7 +16,15 @@ public:
|
||||
void readBytes(void* dest, uint64 size);
|
||||
void writeToStream(std::ostream& stream);
|
||||
void readFromStream(std::istream& stream);
|
||||
enum class SeekOp
|
||||
{
|
||||
CURRENT,
|
||||
BEGIN,
|
||||
END,
|
||||
};
|
||||
void seek(int64 s, SeekOp op);
|
||||
bool eof() const;
|
||||
size_t size() const;
|
||||
void rewind();
|
||||
Gfx::PGraphics& getGraphics();
|
||||
private:
|
||||
@@ -105,7 +113,6 @@ namespace Serialization
|
||||
type.resize(length);
|
||||
buffer.readBytes(type.data(), sizeof(T) * type.size());
|
||||
}
|
||||
|
||||
template<std::floating_point T>
|
||||
static void save(ArchiveBuffer& buffer, const Array<T>& type)
|
||||
{
|
||||
@@ -121,6 +128,26 @@ namespace Serialization
|
||||
type.resize(length);
|
||||
buffer.readBytes(type.data(), sizeof(T) * type.size());
|
||||
}
|
||||
template<std::integral T, size_t N>
|
||||
static void save(ArchiveBuffer& buffer, const StaticArray<T, N>& type)
|
||||
{
|
||||
buffer.writeBytes(type.data(), sizeof(T) * N);
|
||||
}
|
||||
template<std::integral T, size_t N>
|
||||
static void load(ArchiveBuffer& buffer, StaticArray<T, N>& type)
|
||||
{
|
||||
buffer.readBytes(type.data(), sizeof(T) * N);
|
||||
}
|
||||
template<std::floating_point T, size_t N>
|
||||
static void save(ArchiveBuffer& buffer, const StaticArray<T, N>& type)
|
||||
{
|
||||
buffer.writeBytes(type.data(), sizeof(T) * N);
|
||||
}
|
||||
template<std::floating_point T, size_t N>
|
||||
static void load(ArchiveBuffer& buffer, StaticArray<T, N>& type)
|
||||
{
|
||||
buffer.readBytes(type.data(), sizeof(T) * N);
|
||||
}
|
||||
template<typename T>
|
||||
static void save(ArchiveBuffer& buffer, const Array<T>& type) requires (!std::is_integral_v<T> && !std::is_floating_point_v<T>)
|
||||
{
|
||||
|
||||
@@ -3,7 +3,6 @@ target_sources(Engine
|
||||
ArchiveBuffer.h
|
||||
ArchiveBuffer.cpp)
|
||||
|
||||
|
||||
target_sources(Engine
|
||||
PUBLIC FILE_SET HEADERS
|
||||
FILES
|
||||
|
||||
Reference in New Issue
Block a user