Skip to content

Commit

Permalink
linoox pls
Browse files Browse the repository at this point in the history
  • Loading branch information
Xaleros committed May 27, 2024
1 parent 3945b55 commit 7867cb0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
32 changes: 20 additions & 12 deletions SurrealEngine/Editor/Export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ MemoryStreamWriter Exporter::ExportFireTexture(UFireTexture* tex)
data << "=(R=" << std::to_string(r);
data << ",G=" << std::to_string(g);
data << ",B=" << std::to_string(b);
data << ",A=" << std::to_string(a) + ")\r\n";
data << ",A=" << std::to_string(a);
data << ")\r\n";
}

// Export full color palette as well
Expand All @@ -136,7 +137,8 @@ MemoryStreamWriter Exporter::ExportFireTexture(UFireTexture* tex)
data << "=(R=" << std::to_string(r);
data << ",G=" << std::to_string(g);
data << ",B=" << std::to_string(b);
data << ",A=" << std::to_string(a) + ")\r\n";
data << ",A=" << std::to_string(a);
data << ")\r\n";
}

data << "END OBJECT\r\n";
Expand All @@ -161,7 +163,8 @@ MemoryStreamWriter Exporter::ExportWaveTexture(UWaveTexture* tex)
data << "=(R=" << std::to_string(r);
data << ",G=" << std::to_string(g);
data << ",B=" << std::to_string(b);
data << ",A=" << std::to_string(a) + ")\r\n";
data << ",A=" << std::to_string(a);
data << ")\r\n";
}

// Export full color palette as well
Expand All @@ -174,7 +177,8 @@ MemoryStreamWriter Exporter::ExportWaveTexture(UWaveTexture* tex)
data << "=(R=" << std::to_string(r);
data << ",G=" << std::to_string(g);
data << ",B=" << std::to_string(b);
data << ",A=" << std::to_string(a) + ")\r\n";
data << ",A=" << std::to_string(a);
data << ")\r\n";
}

data << "END OBJECT\r\n";
Expand All @@ -199,7 +203,8 @@ MemoryStreamWriter Exporter::ExportWetTexture(UWetTexture* tex)
data << "=(R=" << std::to_string(r);
data << ",G=" << std::to_string(g);
data << ",B=" << std::to_string(b);
data << ",A=" << std::to_string(a) + ")\r\n";
data << ",A=" << std::to_string(a);
data << ")\r\n";
}

// Export full color palette as well
Expand All @@ -212,7 +217,8 @@ MemoryStreamWriter Exporter::ExportWetTexture(UWetTexture* tex)
data << "=(R=" << std::to_string(r);
data << ",G=" << std::to_string(g);
data << ",B=" << std::to_string(b);
data << ",A=" << std::to_string(a) + ")\r\n";
data << ",A=" << std::to_string(a);
data << ")\r\n";
}

data << "END OBJECT\r\n";
Expand All @@ -237,7 +243,8 @@ MemoryStreamWriter Exporter::ExportIceTexture(UIceTexture* tex)
data << "=(R=" << std::to_string(r);
data << ",G=" << std::to_string(g);
data << ",B=" << std::to_string(b);
data << ",A=" << std::to_string(a) + ")\r\n";
data << ",A=" << std::to_string(a);
data << ")\r\n";
}

// Export full color palette as well
Expand All @@ -250,7 +257,8 @@ MemoryStreamWriter Exporter::ExportIceTexture(UIceTexture* tex)
data << "=(R=" << std::to_string(r);
data << ",G=" << std::to_string(g);
data << ",B=" << std::to_string(b);
data << ",A=" << std::to_string(a) + ")\r\n";
data << ",A=" << std::to_string(a);
data << ")\r\n";
}

data << "END OBJECT\r\n";
Expand All @@ -259,7 +267,7 @@ MemoryStreamWriter Exporter::ExportIceTexture(UIceTexture* tex)

/////////////////////////////////////////////////////////////////////////////

struct BmpHeader
struct BmpHeaderV3
{
uint16_t signature;
uint32_t fileSize;
Expand All @@ -279,7 +287,7 @@ struct BmpHeader
uint32_t colorsImportant;
};

MemoryStreamWriter& operator<<(MemoryStreamWriter& s, BmpHeader& bmp)
MemoryStreamWriter& operator<<(MemoryStreamWriter& s, BmpHeaderV3& bmp)
{
s << bmp.signature;
s << bmp.fileSize;
Expand All @@ -303,7 +311,7 @@ MemoryStreamWriter& operator<<(MemoryStreamWriter& s, BmpHeader& bmp)
MemoryStreamWriter Exporter::ExportBmpIndexed(UTexture* tex)
{
MemoryStreamWriter data;
BmpHeader hdr = { 0 };
BmpHeaderV3 hdr = { 0 };
int usize = tex->USize();
int vsize = tex->VSize();

Expand All @@ -316,7 +324,7 @@ MemoryStreamWriter Exporter::ExportBmpIndexed(UTexture* tex)

hdr.signature = 0x4d42;
hdr.fileSize = 0; // re-fill later
hdr.pixelOffset = sizeof(BmpHeader) + (4 * 256);
hdr.pixelOffset = sizeof(BmpHeaderV3) + (4 * 256);
hdr.dibHeaderSize = 40;
hdr.imageWidth = tex->USize();
hdr.imageHeight = tex->VSize();
Expand Down
2 changes: 1 addition & 1 deletion SurrealEngine/Lib/MemoryStreamWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class MemoryStreamWriter
Write(s, strlen(s));
return *this;
}
MemoryStreamWriter& operator<<(std::string& s)
MemoryStreamWriter& operator<<(std::string s)
{
Write(s.data(), s.size());
return *this;
Expand Down

0 comments on commit 7867cb0

Please sign in to comment.