mirror of
https://github.com/leozide/leocad
synced 2025-01-30 20:34:56 +01:00
Removed lcint types.
This commit is contained in:
parent
c612397b9d
commit
636e013455
33 changed files with 353 additions and 363 deletions
|
@ -189,7 +189,7 @@ bool lcCamera::ParseLDrawLine(QTextStream& Stream)
|
||||||
|
|
||||||
bool lcCamera::FileLoad(lcFile& file)
|
bool lcCamera::FileLoad(lcFile& file)
|
||||||
{
|
{
|
||||||
lcuint8 version, ch;
|
quint8 version, ch;
|
||||||
|
|
||||||
version = file.ReadU8();
|
version = file.ReadU8();
|
||||||
|
|
||||||
|
@ -201,10 +201,10 @@ bool lcCamera::FileLoad(lcFile& file)
|
||||||
if (file.ReadU8() != 1)
|
if (file.ReadU8() != 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
lcuint16 time;
|
quint16 time;
|
||||||
float param[4];
|
float param[4];
|
||||||
lcuint8 type;
|
quint8 type;
|
||||||
lcuint32 n;
|
quint32 n;
|
||||||
|
|
||||||
file.ReadU32(&n, 1);
|
file.ReadU32(&n, 1);
|
||||||
while (n--)
|
while (n--)
|
||||||
|
@ -274,7 +274,7 @@ bool lcCamera::FileLoad(lcFile& file)
|
||||||
|
|
||||||
while (ch--)
|
while (ch--)
|
||||||
{
|
{
|
||||||
lcuint8 step;
|
quint8 step;
|
||||||
double eye[3], target[3], up[3];
|
double eye[3], target[3], up[3];
|
||||||
float f[3];
|
float f[3];
|
||||||
|
|
||||||
|
@ -314,13 +314,13 @@ bool lcCamera::FileLoad(lcFile& file)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lcint32 n;
|
qint32 n;
|
||||||
|
|
||||||
if (version < 6)
|
if (version < 6)
|
||||||
{
|
{
|
||||||
lcuint16 time;
|
quint16 time;
|
||||||
float param[4];
|
float param[4];
|
||||||
lcuint8 type;
|
quint8 type;
|
||||||
|
|
||||||
n = file.ReadS32();
|
n = file.ReadS32();
|
||||||
while (n--)
|
while (n--)
|
||||||
|
@ -367,8 +367,8 @@ bool lcCamera::FileLoad(lcFile& file)
|
||||||
|
|
||||||
if ((version > 1) && (version < 4))
|
if ((version > 1) && (version < 4))
|
||||||
{
|
{
|
||||||
lcuint32 show;
|
quint32 show;
|
||||||
lcint32 user;
|
qint32 user;
|
||||||
|
|
||||||
file.ReadU32(&show, 1);
|
file.ReadU32(&show, 1);
|
||||||
// if (version > 2)
|
// if (version > 2)
|
||||||
|
|
|
@ -72,7 +72,7 @@ public:
|
||||||
return (mState & LC_CAMERA_SELECTION_MASK) != 0;
|
return (mState & LC_CAMERA_SELECTION_MASK) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool IsSelected(lcuint32 Section) const override
|
virtual bool IsSelected(quint32 Section) const override
|
||||||
{
|
{
|
||||||
switch (Section)
|
switch (Section)
|
||||||
{
|
{
|
||||||
|
@ -99,7 +99,7 @@ public:
|
||||||
mState &= ~(LC_CAMERA_SELECTION_MASK | LC_CAMERA_FOCUS_MASK);
|
mState &= ~(LC_CAMERA_SELECTION_MASK | LC_CAMERA_FOCUS_MASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void SetSelected(lcuint32 Section, bool Selected) override
|
virtual void SetSelected(quint32 Section, bool Selected) override
|
||||||
{
|
{
|
||||||
switch (Section)
|
switch (Section)
|
||||||
{
|
{
|
||||||
|
@ -131,7 +131,7 @@ public:
|
||||||
return (mState & LC_CAMERA_FOCUS_MASK) != 0;
|
return (mState & LC_CAMERA_FOCUS_MASK) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool IsFocused(lcuint32 Section) const override
|
virtual bool IsFocused(quint32 Section) const override
|
||||||
{
|
{
|
||||||
switch (Section)
|
switch (Section)
|
||||||
{
|
{
|
||||||
|
@ -150,7 +150,7 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void SetFocused(lcuint32 Section, bool Focus) override
|
virtual void SetFocused(quint32 Section, bool Focus) override
|
||||||
{
|
{
|
||||||
switch (Section)
|
switch (Section)
|
||||||
{
|
{
|
||||||
|
@ -177,7 +177,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual lcuint32 GetFocusSection() const override
|
virtual quint32 GetFocusSection() const override
|
||||||
{
|
{
|
||||||
if (mState & LC_CAMERA_POSITION_FOCUSED)
|
if (mState & LC_CAMERA_POSITION_FOCUSED)
|
||||||
return LC_CAMERA_SECTION_POSITION;
|
return LC_CAMERA_SECTION_POSITION;
|
||||||
|
@ -191,12 +191,12 @@ public:
|
||||||
return ~0;
|
return ~0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual lcuint32 GetAllowedTransforms() const override
|
virtual quint32 GetAllowedTransforms() const override
|
||||||
{
|
{
|
||||||
return LC_OBJECT_TRANSFORM_MOVE_X | LC_OBJECT_TRANSFORM_MOVE_Y | LC_OBJECT_TRANSFORM_MOVE_Z;
|
return LC_OBJECT_TRANSFORM_MOVE_X | LC_OBJECT_TRANSFORM_MOVE_Y | LC_OBJECT_TRANSFORM_MOVE_Z;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual lcVector3 GetSectionPosition(lcuint32 Section) const override
|
virtual lcVector3 GetSectionPosition(quint32 Section) const override
|
||||||
{
|
{
|
||||||
switch (Section)
|
switch (Section)
|
||||||
{
|
{
|
||||||
|
@ -301,6 +301,6 @@ protected:
|
||||||
|
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
|
||||||
lcuint32 mState;
|
quint32 mState;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ lcGroup::~lcGroup()
|
||||||
|
|
||||||
void lcGroup::FileLoad(lcFile* File)
|
void lcGroup::FileLoad(lcFile* File)
|
||||||
{
|
{
|
||||||
lcint32 GroupIndex;
|
qint32 GroupIndex;
|
||||||
char Name[LC_MAX_GROUP_NAME + 1];
|
char Name[LC_MAX_GROUP_NAME + 1];
|
||||||
|
|
||||||
File->ReadU8();
|
File->ReadU8();
|
||||||
|
|
|
@ -7,7 +7,7 @@ static void CopyFromQImage(const QImage& Src, Image& Dest)
|
||||||
bool Alpha = Src.hasAlphaChannel();
|
bool Alpha = Src.hasAlphaChannel();
|
||||||
Dest.Allocate(Src.width(), Src.height(), Alpha ? LC_PIXEL_FORMAT_R8G8B8A8 : LC_PIXEL_FORMAT_R8G8B8);
|
Dest.Allocate(Src.width(), Src.height(), Alpha ? LC_PIXEL_FORMAT_R8G8B8A8 : LC_PIXEL_FORMAT_R8G8B8);
|
||||||
|
|
||||||
lcuint8* Bytes = (lcuint8*)Dest.mData;
|
quint8* Bytes = (quint8*)Dest.mData;
|
||||||
|
|
||||||
for (int y = 0; y < Dest.mHeight; y++)
|
for (int y = 0; y < Dest.mHeight; y++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,10 +26,10 @@ public:
|
||||||
bool mDrawEdgeLines;
|
bool mDrawEdgeLines;
|
||||||
float mLineWidth;
|
float mLineWidth;
|
||||||
bool mDrawGridStuds;
|
bool mDrawGridStuds;
|
||||||
lcuint32 mGridStudColor;
|
quint32 mGridStudColor;
|
||||||
bool mDrawGridLines;
|
bool mDrawGridLines;
|
||||||
int mGridLineSpacing;
|
int mGridLineSpacing;
|
||||||
lcuint32 mGridLineColor;
|
quint32 mGridLineColor;
|
||||||
bool mFixedAxes;
|
bool mFixedAxes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -321,7 +321,7 @@ bool lcLoadColorFile(lcFile& File)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the new color is valid.
|
// Check if the new color is valid.
|
||||||
if (Color.Code == (lcuint32)-1 || Color.Value[0] == FLT_MAX)
|
if (Color.Code == (quint32)-1 || Color.Value[0] == FLT_MAX)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (Color.Edge[0] == FLT_MAX)
|
if (Color.Edge[0] == FLT_MAX)
|
||||||
|
@ -402,7 +402,7 @@ void lcLoadDefaultColors()
|
||||||
lcLoadColorFile(MemSettings);
|
lcLoadColorFile(MemSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
int lcGetColorIndex(lcuint32 ColorCode)
|
int lcGetColorIndex(quint32 ColorCode)
|
||||||
{
|
{
|
||||||
for (int ColorIdx = 0; ColorIdx < gColorList.GetSize(); ColorIdx++)
|
for (int ColorIdx = 0; ColorIdx < gColorList.GetSize(); ColorIdx++)
|
||||||
if (gColorList[ColorIdx].Code == ColorCode)
|
if (gColorList[ColorIdx].Code == ColorCode)
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
struct lcColor
|
struct lcColor
|
||||||
{
|
{
|
||||||
lcuint32 Code;
|
quint32 Code;
|
||||||
bool Translucent;
|
bool Translucent;
|
||||||
lcVector4 Value;
|
lcVector4 Value;
|
||||||
lcVector4 Edge;
|
lcVector4 Edge;
|
||||||
|
@ -51,22 +51,22 @@ extern int gDefaultColor;
|
||||||
|
|
||||||
void lcLoadDefaultColors();
|
void lcLoadDefaultColors();
|
||||||
bool lcLoadColorFile(lcFile& File);
|
bool lcLoadColorFile(lcFile& File);
|
||||||
int lcGetColorIndex(lcuint32 ColorCode);
|
int lcGetColorIndex(quint32 ColorCode);
|
||||||
int lcGetBrickLinkColor(int ColorIndex);
|
int lcGetBrickLinkColor(int ColorIndex);
|
||||||
|
|
||||||
inline lcuint32 lcGetColorCodeFromExtendedColor(int Color)
|
inline quint32 lcGetColorCodeFromExtendedColor(int Color)
|
||||||
{
|
{
|
||||||
const int ConverstionTable[] = { 4, 12, 2, 10, 1, 9, 14, 15, 8, 0, 6, 13, 13, 334, 36, 44, 34, 42, 33, 41, 46, 47, 7, 382, 6, 13, 11, 383 };
|
const int ConverstionTable[] = { 4, 12, 2, 10, 1, 9, 14, 15, 8, 0, 6, 13, 13, 334, 36, 44, 34, 42, 33, 41, 46, 47, 7, 382, 6, 13, 11, 383 };
|
||||||
return ConverstionTable[Color];
|
return ConverstionTable[Color];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline lcuint32 lcGetColorCodeFromOriginalColor(int Color)
|
inline quint32 lcGetColorCodeFromOriginalColor(int Color)
|
||||||
{
|
{
|
||||||
const int ConverstionTable[] = { 0, 2, 4, 9, 7, 6, 22, 8, 10, 11, 14, 16, 18, 9, 21, 20, 22, 8, 10, 11 };
|
const int ConverstionTable[] = { 0, 2, 4, 9, 7, 6, 22, 8, 10, 11, 14, 16, 18, 9, 21, 20, 22, 8, 10, 11 };
|
||||||
return lcGetColorCodeFromExtendedColor(ConverstionTable[Color]);
|
return lcGetColorCodeFromExtendedColor(ConverstionTable[Color]);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline lcuint32 lcGetColorCode(int ColorIndex)
|
inline quint32 lcGetColorCode(int ColorIndex)
|
||||||
{
|
{
|
||||||
return gColorList[ColorIndex].Code;
|
return gColorList[ColorIndex].Code;
|
||||||
}
|
}
|
||||||
|
|
110
common/lc_file.h
110
common/lc_file.h
|
@ -4,8 +4,8 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "lc_math.h"
|
#include "lc_math.h"
|
||||||
|
|
||||||
#define LC_FOURCC(ch0, ch1, ch2, ch3) (lcuint32)((lcuint32)(lcuint8)(ch0) | ((lcuint32)(lcuint8)(ch1) << 8) | \
|
#define LC_FOURCC(ch0, ch1, ch2, ch3) (quint32)((quint32)(quint8)(ch0) | ((quint32)(quint8)(ch1) << 8) | \
|
||||||
((lcuint32)(lcuint8)(ch2) << 16) | ((lcuint32)(lcuint8)(ch3) << 24 ))
|
((quint32)(quint8)(ch2) << 16) | ((quint32)(quint8)(ch3) << 24 ))
|
||||||
|
|
||||||
class lcFile
|
class lcFile
|
||||||
{
|
{
|
||||||
|
@ -33,98 +33,98 @@ public:
|
||||||
virtual size_t ReadBuffer(void* Buffer, size_t Bytes) = 0;
|
virtual size_t ReadBuffer(void* Buffer, size_t Bytes) = 0;
|
||||||
virtual size_t WriteBuffer(const void* Buffer, size_t Bytes) = 0;
|
virtual size_t WriteBuffer(const void* Buffer, size_t Bytes) = 0;
|
||||||
|
|
||||||
lcuint8 ReadU8()
|
quint8 ReadU8()
|
||||||
{
|
{
|
||||||
lcuint8 Value;
|
quint8 Value;
|
||||||
Read8(&Value, 1);
|
Read8(&Value, 1);
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ReadU8(lcuint8* Buffer, size_t Count)
|
size_t ReadU8(quint8* Buffer, size_t Count)
|
||||||
{
|
{
|
||||||
return Read8(Buffer, Count);
|
return Read8(Buffer, Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
lcint8 ReadS8()
|
qint8 ReadS8()
|
||||||
{
|
{
|
||||||
lcint8 Value;
|
qint8 Value;
|
||||||
Read8(&Value, 1);
|
Read8(&Value, 1);
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ReadS8(lcint8* Buffer, size_t Count)
|
size_t ReadS8(qint8* Buffer, size_t Count)
|
||||||
{
|
{
|
||||||
return Read8(Buffer, Count);
|
return Read8(Buffer, Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
lcuint16 ReadU16()
|
quint16 ReadU16()
|
||||||
{
|
{
|
||||||
lcuint16 Value;
|
quint16 Value;
|
||||||
Read16(&Value, 1);
|
Read16(&Value, 1);
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ReadU16(lcuint16* Buffer, size_t Count)
|
size_t ReadU16(quint16* Buffer, size_t Count)
|
||||||
{
|
{
|
||||||
return Read16(Buffer, Count);
|
return Read16(Buffer, Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
lcint16 ReadS16()
|
qint16 ReadS16()
|
||||||
{
|
{
|
||||||
lcint16 Value;
|
qint16 Value;
|
||||||
Read16(&Value, 1);
|
Read16(&Value, 1);
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ReadS16(lcint16* Buffer, size_t Count)
|
size_t ReadS16(qint16* Buffer, size_t Count)
|
||||||
{
|
{
|
||||||
return Read16(Buffer, Count);
|
return Read16(Buffer, Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
lcuint32 ReadU32()
|
quint32 ReadU32()
|
||||||
{
|
{
|
||||||
lcuint32 Value;
|
quint32 Value;
|
||||||
Read32(&Value, 1);
|
Read32(&Value, 1);
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ReadU32(lcuint32* Buffer, size_t Count)
|
size_t ReadU32(quint32* Buffer, size_t Count)
|
||||||
{
|
{
|
||||||
return Read32(Buffer, Count);
|
return Read32(Buffer, Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
lcint32 ReadS32()
|
qint32 ReadS32()
|
||||||
{
|
{
|
||||||
lcint32 Value;
|
qint32 Value;
|
||||||
Read32(&Value, 1);
|
Read32(&Value, 1);
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ReadS32(lcint32* Buffer, size_t Count)
|
size_t ReadS32(qint32* Buffer, size_t Count)
|
||||||
{
|
{
|
||||||
return Read32(Buffer, Count);
|
return Read32(Buffer, Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
lcuint64 ReadU64()
|
quint64 ReadU64()
|
||||||
{
|
{
|
||||||
lcuint64 Value;
|
quint64 Value;
|
||||||
Read64(&Value, 1);
|
Read64(&Value, 1);
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ReadU64(lcuint64* Buffer, size_t Count)
|
size_t ReadU64(quint64* Buffer, size_t Count)
|
||||||
{
|
{
|
||||||
return Read64(Buffer, Count);
|
return Read64(Buffer, Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
lcint64 ReadS64()
|
qint64 ReadS64()
|
||||||
{
|
{
|
||||||
lcint64 Value;
|
qint64 Value;
|
||||||
Read64(&Value, 1);
|
Read64(&Value, 1);
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ReadS64(lcint64* Buffer, size_t Count)
|
size_t ReadS64(qint64* Buffer, size_t Count)
|
||||||
{
|
{
|
||||||
return Read64(Buffer, Count);
|
return Read64(Buffer, Count);
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ public:
|
||||||
|
|
||||||
QString ReadQString()
|
QString ReadQString()
|
||||||
{
|
{
|
||||||
uint32_t Size = ReadU32();
|
quint32 Size = ReadU32();
|
||||||
char* Buffer = new char[Size];
|
char* Buffer = new char[Size];
|
||||||
ReadBuffer(Buffer, Size);
|
ReadBuffer(Buffer, Size);
|
||||||
QString String = QString::fromUtf8(Buffer, Size);
|
QString String = QString::fromUtf8(Buffer, Size);
|
||||||
|
@ -170,82 +170,82 @@ public:
|
||||||
return String;
|
return String;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteU8(const lcuint8& Value)
|
void WriteU8(const quint8& Value)
|
||||||
{
|
{
|
||||||
Write8(&Value, 1);
|
Write8(&Value, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t WriteU8(const lcuint8* Buffer, size_t Count)
|
size_t WriteU8(const quint8* Buffer, size_t Count)
|
||||||
{
|
{
|
||||||
return Write8(Buffer, Count);
|
return Write8(Buffer, Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteS8(const lcint8& Value)
|
void WriteS8(const qint8& Value)
|
||||||
{
|
{
|
||||||
Write8(&Value, 1);
|
Write8(&Value, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t WriteS8(const lcint8* Buffer, size_t Count)
|
size_t WriteS8(const qint8* Buffer, size_t Count)
|
||||||
{
|
{
|
||||||
return Write8(Buffer, Count);
|
return Write8(Buffer, Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteU16(const lcuint16& Value)
|
void WriteU16(const quint16& Value)
|
||||||
{
|
{
|
||||||
Write16(&Value, 1);
|
Write16(&Value, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t WriteU16(const lcuint16* Buffer, size_t Count)
|
size_t WriteU16(const quint16* Buffer, size_t Count)
|
||||||
{
|
{
|
||||||
return Write16(Buffer, Count);
|
return Write16(Buffer, Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteS16(const lcint16& Value)
|
void WriteS16(const qint16& Value)
|
||||||
{
|
{
|
||||||
Write16(&Value, 1);
|
Write16(&Value, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t WriteS16(const lcint16* Buffer, size_t Count)
|
size_t WriteS16(const qint16* Buffer, size_t Count)
|
||||||
{
|
{
|
||||||
return Write16(Buffer, Count);
|
return Write16(Buffer, Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteU32(const lcuint32& Value)
|
void WriteU32(const quint32& Value)
|
||||||
{
|
{
|
||||||
Write32(&Value, 1);
|
Write32(&Value, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t WriteU32(const lcuint32* Buffer, size_t Count)
|
size_t WriteU32(const quint32* Buffer, size_t Count)
|
||||||
{
|
{
|
||||||
return Write32(Buffer, Count);
|
return Write32(Buffer, Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteS32(const lcint32& Value)
|
void WriteS32(const qint32& Value)
|
||||||
{
|
{
|
||||||
Write32(&Value, 1);
|
Write32(&Value, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t WriteS32(const lcint32* Buffer, size_t Count)
|
size_t WriteS32(const qint32* Buffer, size_t Count)
|
||||||
{
|
{
|
||||||
return Write32(Buffer, Count);
|
return Write32(Buffer, Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteU64(const lcuint64& Value)
|
void WriteU64(const quint64& Value)
|
||||||
{
|
{
|
||||||
Write64(&Value, 1);
|
Write64(&Value, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t WriteU64(const lcuint64* Buffer, size_t Count)
|
size_t WriteU64(const quint64* Buffer, size_t Count)
|
||||||
{
|
{
|
||||||
return Write64(Buffer, Count);
|
return Write64(Buffer, Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteS64(const lcint64& Value)
|
void WriteS64(const qint64& Value)
|
||||||
{
|
{
|
||||||
Write64(&Value, 1);
|
Write64(&Value, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t WriteS64(const lcint64* Buffer, size_t Count)
|
size_t WriteS64(const qint64* Buffer, size_t Count)
|
||||||
{
|
{
|
||||||
return Write64(Buffer, Count);
|
return Write64(Buffer, Count);
|
||||||
}
|
}
|
||||||
|
@ -295,8 +295,8 @@ protected:
|
||||||
NumRead = ReadBuffer(Buffer, Count * 2) / 2;
|
NumRead = ReadBuffer(Buffer, Count * 2) / 2;
|
||||||
|
|
||||||
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||||
lcuint8 Temp[2];
|
quint8 Temp[2];
|
||||||
lcuint8* Bytes = (lcuint8*)Buffer;
|
quint8* Bytes = (quint8*)Buffer;
|
||||||
|
|
||||||
for (size_t Idx = 0; Idx < NumRead; Idx++)
|
for (size_t Idx = 0; Idx < NumRead; Idx++)
|
||||||
{
|
{
|
||||||
|
@ -318,8 +318,8 @@ protected:
|
||||||
NumRead = ReadBuffer(Buffer, Count * 4) / 4;
|
NumRead = ReadBuffer(Buffer, Count * 4) / 4;
|
||||||
|
|
||||||
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||||
lcuint8 Temp[4];
|
quint8 Temp[4];
|
||||||
lcuint8* Bytes = (lcuint8*)Buffer;
|
quint8* Bytes = (quint8*)Buffer;
|
||||||
|
|
||||||
for (size_t Idx = 0; Idx < NumRead; Idx++)
|
for (size_t Idx = 0; Idx < NumRead; Idx++)
|
||||||
{
|
{
|
||||||
|
@ -345,8 +345,8 @@ protected:
|
||||||
NumRead = ReadBuffer(Buffer, Count * 8) / 8;
|
NumRead = ReadBuffer(Buffer, Count * 8) / 8;
|
||||||
|
|
||||||
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||||
lcuint8 Temp[8];
|
quint8 Temp[8];
|
||||||
lcuint8* Bytes = (lcuint8*)Buffer;
|
quint8* Bytes = (quint8*)Buffer;
|
||||||
|
|
||||||
for (size_t Idx = 0; Idx < NumRead; Idx++)
|
for (size_t Idx = 0; Idx < NumRead; Idx++)
|
||||||
{
|
{
|
||||||
|
@ -382,8 +382,8 @@ protected:
|
||||||
{
|
{
|
||||||
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||||
size_t BytesWritten = 0;
|
size_t BytesWritten = 0;
|
||||||
lcuint8 Temp[2];
|
quint8 Temp[2];
|
||||||
lcuint8* Bytes = (lcuint8*)Buffer;
|
quint8* Bytes = (quint8*)Buffer;
|
||||||
|
|
||||||
for (size_t Idx = 0; Idx < Count; Idx++)
|
for (size_t Idx = 0; Idx < Count; Idx++)
|
||||||
{
|
{
|
||||||
|
@ -403,8 +403,8 @@ protected:
|
||||||
{
|
{
|
||||||
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||||
size_t BytesWritten = 0;
|
size_t BytesWritten = 0;
|
||||||
lcuint8 Temp[4];
|
quint8 Temp[4];
|
||||||
lcuint8* Bytes = (lcuint8*)Buffer;
|
quint8* Bytes = (quint8*)Buffer;
|
||||||
|
|
||||||
for (size_t Idx = 0; Idx < Count; Idx++)
|
for (size_t Idx = 0; Idx < Count; Idx++)
|
||||||
{
|
{
|
||||||
|
@ -426,8 +426,8 @@ protected:
|
||||||
{
|
{
|
||||||
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||||
size_t BytesWritten = 0;
|
size_t BytesWritten = 0;
|
||||||
lcuint8 Temp[8];
|
quint8 Temp[8];
|
||||||
lcuint8* Bytes = (lcuint8*)Buffer;
|
quint8* Bytes = (quint8*)Buffer;
|
||||||
|
|
||||||
for (size_t Idx = 0; Idx < Count; Idx++)
|
for (size_t Idx = 0; Idx < Count; Idx++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,17 +21,7 @@
|
||||||
// Old defines and declarations.
|
// Old defines and declarations.
|
||||||
#define LC_MAXPATH 1024
|
#define LC_MAXPATH 1024
|
||||||
|
|
||||||
#define LC_POINTER_TO_INT(p) ((lcint32) (quintptr) (p))
|
#define LC_POINTER_TO_INT(p) ((qint32) (quintptr) (p))
|
||||||
|
|
||||||
typedef qint8 lcint8;
|
|
||||||
typedef quint8 lcuint8;
|
|
||||||
typedef qint16 lcint16;
|
|
||||||
typedef quint16 lcuint16;
|
|
||||||
typedef qint32 lcint32;
|
|
||||||
typedef quint32 lcuint32;
|
|
||||||
typedef qint64 lcint64;
|
|
||||||
typedef quint64 lcuint64;
|
|
||||||
typedef quintptr lcuintptr;
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
char* strcasestr(const char *s, const char *find);
|
char* strcasestr(const char *s, const char *find);
|
||||||
|
|
|
@ -761,9 +761,9 @@ void lcPiecesLibrary::ReadDirectoryDescriptions(const QFileInfoList (&FileLists)
|
||||||
IndexFile.WriteU8(Info->mFolderType);
|
IndexFile.WriteU8(Info->mFolderType);
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
|
||||||
uint64_t FileTime = FileLists[Info->mFolderType][Info->mFolderIndex].lastModified().toMSecsSinceEpoch();
|
quint64 FileTime = FileLists[Info->mFolderType][Info->mFolderIndex].lastModified().toMSecsSinceEpoch();
|
||||||
#else
|
#else
|
||||||
uint64_t FileTime = FileLists[Info->mFolderType][Info->mFolderIndex].lastModified().toTime_t();
|
quint64 FileTime = FileLists[Info->mFolderType][Info->mFolderIndex].lastModified().toTime_t();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
IndexFile.WriteU64(FileTime);
|
IndexFile.WriteU64(FileTime);
|
||||||
|
@ -888,7 +888,7 @@ bool lcPiecesLibrary::WriteArchiveCacheFile(const QString& FileName, lcMemFile&
|
||||||
const size_t BufferSize = 16384;
|
const size_t BufferSize = 16384;
|
||||||
char WriteBuffer[BufferSize];
|
char WriteBuffer[BufferSize];
|
||||||
z_stream Stream;
|
z_stream Stream;
|
||||||
lcuint32 Crc32 = 0;
|
quint32 Crc32 = 0;
|
||||||
|
|
||||||
CacheFile.Seek(0, SEEK_SET);
|
CacheFile.Seek(0, SEEK_SET);
|
||||||
|
|
||||||
|
@ -1293,7 +1293,7 @@ lcMesh* lcPiecesLibrary::CreateMesh(PieceInfo* Info, lcLibraryMeshData& MeshData
|
||||||
NumTexturedVertices += MeshData.mTexturedVertices[MeshDataIdx].GetSize();
|
NumTexturedVertices += MeshData.mTexturedVertices[MeshDataIdx].GetSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
lcuint16 NumSections[LC_NUM_MESH_LODS];
|
quint16 NumSections[LC_NUM_MESH_LODS];
|
||||||
int NumIndices = 0;
|
int NumIndices = 0;
|
||||||
|
|
||||||
lcArray<lcMergeSection> MergeSections[LC_NUM_MESH_LODS];
|
lcArray<lcMergeSection> MergeSections[LC_NUM_MESH_LODS];
|
||||||
|
@ -1416,11 +1416,11 @@ lcMesh* lcPiecesLibrary::CreateMesh(PieceInfo* Info, lcLibraryMeshData& MeshData
|
||||||
{
|
{
|
||||||
DstSection.IndexOffset = NumIndices * 2;
|
DstSection.IndexOffset = NumIndices * 2;
|
||||||
|
|
||||||
lcuint16* Index = (lcuint16*)Mesh->mIndexData + NumIndices;
|
quint16* Index = (quint16*)Mesh->mIndexData + NumIndices;
|
||||||
|
|
||||||
if (MergeSection.Shared)
|
if (MergeSection.Shared)
|
||||||
{
|
{
|
||||||
lcuint16 BaseVertex = DstSection.Texture ? BaseTexturedVertices[LC_MESHDATA_SHARED] : BaseVertices[LC_MESHDATA_SHARED];
|
quint16 BaseVertex = DstSection.Texture ? BaseTexturedVertices[LC_MESHDATA_SHARED] : BaseVertices[LC_MESHDATA_SHARED];
|
||||||
lcLibraryMeshSection* SrcSection = MergeSection.Shared;
|
lcLibraryMeshSection* SrcSection = MergeSection.Shared;
|
||||||
|
|
||||||
for (int IndexIdx = 0; IndexIdx < SrcSection->mIndices.GetSize(); IndexIdx++)
|
for (int IndexIdx = 0; IndexIdx < SrcSection->mIndices.GetSize(); IndexIdx++)
|
||||||
|
@ -1431,7 +1431,7 @@ lcMesh* lcPiecesLibrary::CreateMesh(PieceInfo* Info, lcLibraryMeshData& MeshData
|
||||||
|
|
||||||
if (MergeSection.Lod)
|
if (MergeSection.Lod)
|
||||||
{
|
{
|
||||||
lcuint16 BaseVertex = DstSection.Texture ? BaseTexturedVertices[LodIdx] : BaseVertices[LodIdx];
|
quint16 BaseVertex = DstSection.Texture ? BaseTexturedVertices[LodIdx] : BaseVertices[LodIdx];
|
||||||
lcLibraryMeshSection* SrcSection = MergeSection.Lod;
|
lcLibraryMeshSection* SrcSection = MergeSection.Lod;
|
||||||
|
|
||||||
for (int IndexIdx = 0; IndexIdx < SrcSection->mIndices.GetSize(); IndexIdx++)
|
for (int IndexIdx = 0; IndexIdx < SrcSection->mIndices.GetSize(); IndexIdx++)
|
||||||
|
@ -1444,11 +1444,11 @@ lcMesh* lcPiecesLibrary::CreateMesh(PieceInfo* Info, lcLibraryMeshData& MeshData
|
||||||
{
|
{
|
||||||
DstSection.IndexOffset = NumIndices * 4;
|
DstSection.IndexOffset = NumIndices * 4;
|
||||||
|
|
||||||
lcuint32* Index = (lcuint32*)Mesh->mIndexData + NumIndices;
|
quint32* Index = (quint32*)Mesh->mIndexData + NumIndices;
|
||||||
|
|
||||||
if (MergeSection.Shared)
|
if (MergeSection.Shared)
|
||||||
{
|
{
|
||||||
lcuint32 BaseVertex = DstSection.Texture ? BaseTexturedVertices[LC_MESHDATA_SHARED] : BaseVertices[LC_MESHDATA_SHARED];
|
quint32 BaseVertex = DstSection.Texture ? BaseTexturedVertices[LC_MESHDATA_SHARED] : BaseVertices[LC_MESHDATA_SHARED];
|
||||||
lcLibraryMeshSection* SrcSection = MergeSection.Shared;
|
lcLibraryMeshSection* SrcSection = MergeSection.Shared;
|
||||||
|
|
||||||
for (int IndexIdx = 0; IndexIdx < SrcSection->mIndices.GetSize(); IndexIdx++)
|
for (int IndexIdx = 0; IndexIdx < SrcSection->mIndices.GetSize(); IndexIdx++)
|
||||||
|
@ -1459,7 +1459,7 @@ lcMesh* lcPiecesLibrary::CreateMesh(PieceInfo* Info, lcLibraryMeshData& MeshData
|
||||||
|
|
||||||
if (MergeSection.Lod)
|
if (MergeSection.Lod)
|
||||||
{
|
{
|
||||||
lcuint32 BaseVertex = DstSection.Texture ? BaseTexturedVertices[LodIdx] : BaseVertices[LodIdx];
|
quint32 BaseVertex = DstSection.Texture ? BaseTexturedVertices[LodIdx] : BaseVertices[LodIdx];
|
||||||
lcLibraryMeshSection* SrcSection = MergeSection.Lod;
|
lcLibraryMeshSection* SrcSection = MergeSection.Lod;
|
||||||
|
|
||||||
for (int IndexIdx = 0; IndexIdx < SrcSection->mIndices.GetSize(); IndexIdx++)
|
for (int IndexIdx = 0; IndexIdx < SrcSection->mIndices.GetSize(); IndexIdx++)
|
||||||
|
@ -1511,7 +1511,7 @@ lcMesh* lcPiecesLibrary::CreateMesh(PieceInfo* Info, lcLibraryMeshData& MeshData
|
||||||
{
|
{
|
||||||
DstSection.IndexOffset = NumIndices * 2;
|
DstSection.IndexOffset = NumIndices * 2;
|
||||||
|
|
||||||
lcuint16* Index = (lcuint16*)Mesh->mIndexData + NumIndices;
|
quint16* Index = (quint16*)Mesh->mIndexData + NumIndices;
|
||||||
|
|
||||||
for (int IndexIdx = 0; IndexIdx < DstSection.NumIndices; IndexIdx++)
|
for (int IndexIdx = 0; IndexIdx < DstSection.NumIndices; IndexIdx++)
|
||||||
*Index++ = SrcSection->mIndices[IndexIdx];
|
*Index++ = SrcSection->mIndices[IndexIdx];
|
||||||
|
@ -1520,7 +1520,7 @@ lcMesh* lcPiecesLibrary::CreateMesh(PieceInfo* Info, lcLibraryMeshData& MeshData
|
||||||
{
|
{
|
||||||
DstSection.IndexOffset = NumIndices * 4;
|
DstSection.IndexOffset = NumIndices * 4;
|
||||||
|
|
||||||
lcuint32* Index = (lcuint32*)Mesh->mIndexData + NumIndices;
|
quint32* Index = (quint32*)Mesh->mIndexData + NumIndices;
|
||||||
|
|
||||||
for (int IndexIdx = 0; IndexIdx < DstSection.NumIndices; IndexIdx++)
|
for (int IndexIdx = 0; IndexIdx < DstSection.NumIndices; IndexIdx++)
|
||||||
*Index++ = SrcSection->mIndices[IndexIdx];
|
*Index++ = SrcSection->mIndices[IndexIdx];
|
||||||
|
@ -1770,7 +1770,7 @@ bool lcPiecesLibrary::LoadPrimitive(lcLibraryPrimitive* Primitive)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool lcPiecesLibrary::ReadMeshData(lcFile& File, const lcMatrix44& CurrentTransform, lcuint32 CurrentColorCode, bool InvertWinding, lcArray<lcLibraryTextureMap>& TextureStack, lcLibraryMeshData& MeshData, lcMeshDataType MeshDataType, bool Optimize, Project* CurrentProject, bool SearchProjectFolder)
|
bool lcPiecesLibrary::ReadMeshData(lcFile& File, const lcMatrix44& CurrentTransform, quint32 CurrentColorCode, bool InvertWinding, lcArray<lcLibraryTextureMap>& TextureStack, lcLibraryMeshData& MeshData, lcMeshDataType MeshDataType, bool Optimize, Project* CurrentProject, bool SearchProjectFolder)
|
||||||
{
|
{
|
||||||
char Buffer[1024];
|
char Buffer[1024];
|
||||||
char* Line;
|
char* Line;
|
||||||
|
@ -1782,7 +1782,7 @@ bool lcPiecesLibrary::ReadMeshData(lcFile& File, const lcMatrix44& CurrentTransf
|
||||||
if (mCancelLoading)
|
if (mCancelLoading)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
lcuint32 ColorCode, ColorCodeHex;
|
quint32 ColorCode, ColorCodeHex;
|
||||||
bool LastToken = false;
|
bool LastToken = false;
|
||||||
int LineType;
|
int LineType;
|
||||||
|
|
||||||
|
@ -2208,7 +2208,7 @@ void lcLibraryMeshData::TestQuad(int* QuadIndices, const lcVector3* Vertices)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lcLibraryMeshSection* lcLibraryMeshData::AddSection(lcMeshDataType MeshDataType, lcMeshPrimitiveType PrimitiveType, lcuint32 ColorCode, lcTexture* Texture)
|
lcLibraryMeshSection* lcLibraryMeshData::AddSection(lcMeshDataType MeshDataType, lcMeshPrimitiveType PrimitiveType, quint32 ColorCode, lcTexture* Texture)
|
||||||
{
|
{
|
||||||
lcArray<lcLibraryMeshSection*>& Sections = mSections[MeshDataType];
|
lcArray<lcLibraryMeshSection*>& Sections = mSections[MeshDataType];
|
||||||
lcLibraryMeshSection* Section;
|
lcLibraryMeshSection* Section;
|
||||||
|
@ -2238,7 +2238,7 @@ void lcLibraryMeshData::AddVertices(lcMeshDataType MeshDataType, int VertexCount
|
||||||
*VertexBuffer = &Vertices[CurrentSize];
|
*VertexBuffer = &Vertices[CurrentSize];
|
||||||
}
|
}
|
||||||
|
|
||||||
lcuint32 lcLibraryMeshData::AddVertex(lcMeshDataType MeshDataType, const lcVector3& Position, bool Optimize)
|
quint32 lcLibraryMeshData::AddVertex(lcMeshDataType MeshDataType, const lcVector3& Position, bool Optimize)
|
||||||
{
|
{
|
||||||
lcArray<lcLibraryMeshVertex>& VertexArray = mVertices[MeshDataType];
|
lcArray<lcLibraryMeshVertex>& VertexArray = mVertices[MeshDataType];
|
||||||
|
|
||||||
|
@ -2263,7 +2263,7 @@ lcuint32 lcLibraryMeshData::AddVertex(lcMeshDataType MeshDataType, const lcVecto
|
||||||
|
|
||||||
const float DistanceEpsilon = 0.05f;
|
const float DistanceEpsilon = 0.05f;
|
||||||
|
|
||||||
lcuint32 lcLibraryMeshData::AddVertex(lcMeshDataType MeshDataType, const lcVector3& Position, const lcVector3& Normal, bool Optimize)
|
quint32 lcLibraryMeshData::AddVertex(lcMeshDataType MeshDataType, const lcVector3& Position, const lcVector3& Normal, bool Optimize)
|
||||||
{
|
{
|
||||||
lcArray<lcLibraryMeshVertex>& VertexArray = mVertices[MeshDataType];
|
lcArray<lcLibraryMeshVertex>& VertexArray = mVertices[MeshDataType];
|
||||||
|
|
||||||
|
@ -2300,7 +2300,7 @@ lcuint32 lcLibraryMeshData::AddVertex(lcMeshDataType MeshDataType, const lcVecto
|
||||||
return VertexArray.GetSize() - 1;
|
return VertexArray.GetSize() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
lcuint32 lcLibraryMeshData::AddTexturedVertex(lcMeshDataType MeshDataType, const lcVector3& Position, const lcVector2& TexCoord, bool Optimize)
|
quint32 lcLibraryMeshData::AddTexturedVertex(lcMeshDataType MeshDataType, const lcVector3& Position, const lcVector2& TexCoord, bool Optimize)
|
||||||
{
|
{
|
||||||
lcArray<lcLibraryMeshVertexTextured>& VertexArray = mTexturedVertices[MeshDataType];
|
lcArray<lcLibraryMeshVertexTextured>& VertexArray = mTexturedVertices[MeshDataType];
|
||||||
|
|
||||||
|
@ -2324,7 +2324,7 @@ lcuint32 lcLibraryMeshData::AddTexturedVertex(lcMeshDataType MeshDataType, const
|
||||||
return VertexArray.GetSize() - 1;
|
return VertexArray.GetSize() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
lcuint32 lcLibraryMeshData::AddTexturedVertex(lcMeshDataType MeshDataType, const lcVector3& Position, const lcVector3& Normal, const lcVector2& TexCoord, bool Optimize)
|
quint32 lcLibraryMeshData::AddTexturedVertex(lcMeshDataType MeshDataType, const lcVector3& Position, const lcVector3& Normal, const lcVector2& TexCoord, bool Optimize)
|
||||||
{
|
{
|
||||||
lcArray<lcLibraryMeshVertexTextured>& VertexArray = mTexturedVertices[MeshDataType];
|
lcArray<lcLibraryMeshVertexTextured>& VertexArray = mTexturedVertices[MeshDataType];
|
||||||
|
|
||||||
|
@ -2361,10 +2361,10 @@ lcuint32 lcLibraryMeshData::AddTexturedVertex(lcMeshDataType MeshDataType, const
|
||||||
return VertexArray.GetSize() - 1;
|
return VertexArray.GetSize() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcLibraryMeshData::AddIndices(lcMeshDataType MeshDataType, lcMeshPrimitiveType PrimitiveType, lcuint32 ColorCode, int IndexCount, lcuint32** IndexBuffer)
|
void lcLibraryMeshData::AddIndices(lcMeshDataType MeshDataType, lcMeshPrimitiveType PrimitiveType, quint32 ColorCode, int IndexCount, quint32** IndexBuffer)
|
||||||
{
|
{
|
||||||
lcLibraryMeshSection* Section = AddSection(MeshDataType, PrimitiveType, ColorCode, nullptr);
|
lcLibraryMeshSection* Section = AddSection(MeshDataType, PrimitiveType, ColorCode, nullptr);
|
||||||
lcArray<lcuint32>& Indices = Section->mIndices;
|
lcArray<quint32>& Indices = Section->mIndices;
|
||||||
int CurrentSize = Indices.GetSize();
|
int CurrentSize = Indices.GetSize();
|
||||||
|
|
||||||
Indices.SetSize(CurrentSize + IndexCount);
|
Indices.SetSize(CurrentSize + IndexCount);
|
||||||
|
@ -2372,7 +2372,7 @@ void lcLibraryMeshData::AddIndices(lcMeshDataType MeshDataType, lcMeshPrimitiveT
|
||||||
*IndexBuffer = &Indices[CurrentSize];
|
*IndexBuffer = &Indices[CurrentSize];
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcLibraryMeshData::AddLine(lcMeshDataType MeshDataType, int LineType, lcuint32 ColorCode, bool WindingCCW, const lcVector3* Vertices, bool Optimize)
|
void lcLibraryMeshData::AddLine(lcMeshDataType MeshDataType, int LineType, quint32 ColorCode, bool WindingCCW, const lcVector3* Vertices, bool Optimize)
|
||||||
{
|
{
|
||||||
lcMeshPrimitiveType PrimitiveTypes[4] = { LC_MESH_LINES, LC_MESH_TRIANGLES, LC_MESH_TRIANGLES, LC_MESH_CONDITIONAL_LINES };
|
lcMeshPrimitiveType PrimitiveTypes[4] = { LC_MESH_LINES, LC_MESH_TRIANGLES, LC_MESH_TRIANGLES, LC_MESH_CONDITIONAL_LINES };
|
||||||
lcMeshPrimitiveType PrimitiveType = PrimitiveTypes[LineType - 2];
|
lcMeshPrimitiveType PrimitiveType = PrimitiveTypes[LineType - 2];
|
||||||
|
@ -2463,7 +2463,7 @@ void lcLibraryMeshData::AddLine(lcMeshDataType MeshDataType, int LineType, lcuin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcLibraryMeshData::AddTexturedLine(lcMeshDataType MeshDataType, int LineType, lcuint32 ColorCode, bool WindingCCW, const lcLibraryTextureMap& Map, const lcVector3* Vertices, bool Optimize)
|
void lcLibraryMeshData::AddTexturedLine(lcMeshDataType MeshDataType, int LineType, quint32 ColorCode, bool WindingCCW, const lcLibraryTextureMap& Map, const lcVector3* Vertices, bool Optimize)
|
||||||
{
|
{
|
||||||
lcMeshPrimitiveType PrimitiveType = (LineType == 2) ? LC_MESH_TEXTURED_LINES : LC_MESH_TEXTURED_TRIANGLES;
|
lcMeshPrimitiveType PrimitiveType = (LineType == 2) ? LC_MESH_TEXTURED_LINES : LC_MESH_TEXTURED_TRIANGLES;
|
||||||
lcLibraryMeshSection* Section = AddSection(MeshDataType, PrimitiveType, ColorCode, Map.Texture);
|
lcLibraryMeshSection* Section = AddSection(MeshDataType, PrimitiveType, ColorCode, Map.Texture);
|
||||||
|
@ -2545,7 +2545,7 @@ void lcLibraryMeshData::AddTexturedLine(lcMeshDataType MeshDataType, int LineTyp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcLibraryMeshData::AddMeshData(const lcLibraryMeshData& Data, const lcMatrix44& Transform, lcuint32 CurrentColorCode, bool InvertWinding, bool InvertNormals, lcLibraryTextureMap* TextureMap, lcMeshDataType OverrideDestIndex)
|
void lcLibraryMeshData::AddMeshData(const lcLibraryMeshData& Data, const lcMatrix44& Transform, quint32 CurrentColorCode, bool InvertWinding, bool InvertNormals, lcLibraryTextureMap* TextureMap, lcMeshDataType OverrideDestIndex)
|
||||||
{
|
{
|
||||||
for (int MeshDataIdx = 0; MeshDataIdx < LC_NUM_MESHDATA_TYPES; MeshDataIdx++)
|
for (int MeshDataIdx = 0; MeshDataIdx < LC_NUM_MESHDATA_TYPES; MeshDataIdx++)
|
||||||
{
|
{
|
||||||
|
@ -2555,7 +2555,7 @@ void lcLibraryMeshData::AddMeshData(const lcLibraryMeshData& Data, const lcMatri
|
||||||
lcArray<lcLibraryMeshVertexTextured>& TexturedVertices = mTexturedVertices[DestIndex];
|
lcArray<lcLibraryMeshVertexTextured>& TexturedVertices = mTexturedVertices[DestIndex];
|
||||||
|
|
||||||
int VertexCount = DataVertices.GetSize();
|
int VertexCount = DataVertices.GetSize();
|
||||||
lcArray<lcuint32> IndexRemap(VertexCount);
|
lcArray<quint32> IndexRemap(VertexCount);
|
||||||
|
|
||||||
if (!TextureMap)
|
if (!TextureMap)
|
||||||
{
|
{
|
||||||
|
@ -2607,7 +2607,7 @@ void lcLibraryMeshData::AddMeshData(const lcLibraryMeshData& Data, const lcMatri
|
||||||
|
|
||||||
const lcArray<lcLibraryMeshVertexTextured>& DataTexturedVertices = Data.mTexturedVertices[MeshDataIdx];
|
const lcArray<lcLibraryMeshVertexTextured>& DataTexturedVertices = Data.mTexturedVertices[MeshDataIdx];
|
||||||
int TexturedVertexCount = DataTexturedVertices.GetSize();
|
int TexturedVertexCount = DataTexturedVertices.GetSize();
|
||||||
lcArray<lcuint32> TexturedIndexRemap(TexturedVertexCount);
|
lcArray<quint32> TexturedIndexRemap(TexturedVertexCount);
|
||||||
|
|
||||||
if (TexturedVertexCount)
|
if (TexturedVertexCount)
|
||||||
{
|
{
|
||||||
|
@ -2640,7 +2640,7 @@ void lcLibraryMeshData::AddMeshData(const lcLibraryMeshData& Data, const lcMatri
|
||||||
{
|
{
|
||||||
lcLibraryMeshSection* SrcSection = DataSections[SrcSectionIdx];
|
lcLibraryMeshSection* SrcSection = DataSections[SrcSectionIdx];
|
||||||
lcLibraryMeshSection* DstSection = nullptr;
|
lcLibraryMeshSection* DstSection = nullptr;
|
||||||
lcuint32 ColorCode = SrcSection->mColor == 16 ? CurrentColorCode : SrcSection->mColor;
|
quint32 ColorCode = SrcSection->mColor == 16 ? CurrentColorCode : SrcSection->mColor;
|
||||||
lcTexture* Texture;
|
lcTexture* Texture;
|
||||||
|
|
||||||
if (SrcSection->mTexture)
|
if (SrcSection->mTexture)
|
||||||
|
@ -2708,7 +2708,7 @@ void lcLibraryMeshData::AddMeshData(const lcLibraryMeshData& Data, const lcMatri
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcLibraryMeshData::AddMeshDataNoDuplicateCheck(const lcLibraryMeshData& Data, const lcMatrix44& Transform, lcuint32 CurrentColorCode, bool InvertWinding, bool InvertNormals, lcLibraryTextureMap* TextureMap, lcMeshDataType OverrideDestIndex)
|
void lcLibraryMeshData::AddMeshDataNoDuplicateCheck(const lcLibraryMeshData& Data, const lcMatrix44& Transform, quint32 CurrentColorCode, bool InvertWinding, bool InvertNormals, lcLibraryTextureMap* TextureMap, lcMeshDataType OverrideDestIndex)
|
||||||
{
|
{
|
||||||
for (int MeshDataIdx = 0; MeshDataIdx < LC_NUM_MESHDATA_TYPES; MeshDataIdx++)
|
for (int MeshDataIdx = 0; MeshDataIdx < LC_NUM_MESHDATA_TYPES; MeshDataIdx++)
|
||||||
{
|
{
|
||||||
|
@ -2716,7 +2716,7 @@ void lcLibraryMeshData::AddMeshDataNoDuplicateCheck(const lcLibraryMeshData& Dat
|
||||||
const lcArray<lcLibraryMeshVertex>& DataVertices = Data.mVertices[MeshDataIdx];
|
const lcArray<lcLibraryMeshVertex>& DataVertices = Data.mVertices[MeshDataIdx];
|
||||||
lcArray<lcLibraryMeshVertex>& Vertices = mVertices[DestIndex];
|
lcArray<lcLibraryMeshVertex>& Vertices = mVertices[DestIndex];
|
||||||
lcArray<lcLibraryMeshVertexTextured>& TexturedVertices = mTexturedVertices[DestIndex];
|
lcArray<lcLibraryMeshVertexTextured>& TexturedVertices = mTexturedVertices[DestIndex];
|
||||||
lcuint32 BaseIndex;
|
quint32 BaseIndex;
|
||||||
|
|
||||||
if (!TextureMap)
|
if (!TextureMap)
|
||||||
{
|
{
|
||||||
|
@ -2763,7 +2763,7 @@ void lcLibraryMeshData::AddMeshDataNoDuplicateCheck(const lcLibraryMeshData& Dat
|
||||||
const lcArray<lcLibraryMeshVertexTextured>& DataTexturedVertices = Data.mTexturedVertices[MeshDataIdx];
|
const lcArray<lcLibraryMeshVertexTextured>& DataTexturedVertices = Data.mTexturedVertices[MeshDataIdx];
|
||||||
|
|
||||||
int TexturedVertexCount = DataTexturedVertices.GetSize();
|
int TexturedVertexCount = DataTexturedVertices.GetSize();
|
||||||
lcuint32 BaseTexturedIndex = TexturedVertices.GetSize();
|
quint32 BaseTexturedIndex = TexturedVertices.GetSize();
|
||||||
|
|
||||||
if (TexturedVertexCount)
|
if (TexturedVertexCount)
|
||||||
{
|
{
|
||||||
|
@ -2789,7 +2789,7 @@ void lcLibraryMeshData::AddMeshDataNoDuplicateCheck(const lcLibraryMeshData& Dat
|
||||||
{
|
{
|
||||||
lcLibraryMeshSection* SrcSection = DataSections[SrcSectionIdx];
|
lcLibraryMeshSection* SrcSection = DataSections[SrcSectionIdx];
|
||||||
lcLibraryMeshSection* DstSection = nullptr;
|
lcLibraryMeshSection* DstSection = nullptr;
|
||||||
lcuint32 ColorCode = SrcSection->mColor == 16 ? CurrentColorCode : SrcSection->mColor;
|
quint32 ColorCode = SrcSection->mColor == 16 ? CurrentColorCode : SrcSection->mColor;
|
||||||
lcTexture* Texture;
|
lcTexture* Texture;
|
||||||
|
|
||||||
if (SrcSection->mTexture)
|
if (SrcSection->mTexture)
|
||||||
|
|
|
@ -40,7 +40,7 @@ struct lcLibraryMeshVertexTextured
|
||||||
class lcLibraryMeshSection
|
class lcLibraryMeshSection
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
lcLibraryMeshSection(lcMeshPrimitiveType PrimitiveType, lcuint32 Color, lcTexture* Texture)
|
lcLibraryMeshSection(lcMeshPrimitiveType PrimitiveType, quint32 Color, lcTexture* Texture)
|
||||||
: mIndices(1024, 1024)
|
: mIndices(1024, 1024)
|
||||||
{
|
{
|
||||||
mPrimitiveType = PrimitiveType;
|
mPrimitiveType = PrimitiveType;
|
||||||
|
@ -53,9 +53,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
lcMeshPrimitiveType mPrimitiveType;
|
lcMeshPrimitiveType mPrimitiveType;
|
||||||
lcuint32 mColor;
|
quint32 mColor;
|
||||||
lcTexture* mTexture;
|
lcTexture* mTexture;
|
||||||
lcArray<lcuint32> mIndices;
|
lcArray<quint32> mIndices;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct lcLibraryTextureMap
|
struct lcLibraryTextureMap
|
||||||
|
@ -105,17 +105,17 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
lcLibraryMeshSection* AddSection(lcMeshDataType MeshDataType, lcMeshPrimitiveType PrimitiveType, lcuint32 ColorCode, lcTexture* Texture);
|
lcLibraryMeshSection* AddSection(lcMeshDataType MeshDataType, lcMeshPrimitiveType PrimitiveType, quint32 ColorCode, lcTexture* Texture);
|
||||||
lcuint32 AddVertex(lcMeshDataType MeshDataType, const lcVector3& Position, bool Optimize);
|
quint32 AddVertex(lcMeshDataType MeshDataType, const lcVector3& Position, bool Optimize);
|
||||||
lcuint32 AddVertex(lcMeshDataType MeshDataType, const lcVector3& Position, const lcVector3& Normal, bool Optimize);
|
quint32 AddVertex(lcMeshDataType MeshDataType, const lcVector3& Position, const lcVector3& Normal, bool Optimize);
|
||||||
lcuint32 AddTexturedVertex(lcMeshDataType MeshDataType, const lcVector3& Position, const lcVector2& TexCoord, bool Optimize);
|
quint32 AddTexturedVertex(lcMeshDataType MeshDataType, const lcVector3& Position, const lcVector2& TexCoord, bool Optimize);
|
||||||
lcuint32 AddTexturedVertex(lcMeshDataType MeshDataType, const lcVector3& Position, const lcVector3& Normal, const lcVector2& TexCoord, bool Optimize);
|
quint32 AddTexturedVertex(lcMeshDataType MeshDataType, const lcVector3& Position, const lcVector3& Normal, const lcVector2& TexCoord, bool Optimize);
|
||||||
void AddVertices(lcMeshDataType MeshDataType, int VertexCount, int* BaseVertex, lcLibraryMeshVertex** VertexBuffer);
|
void AddVertices(lcMeshDataType MeshDataType, int VertexCount, int* BaseVertex, lcLibraryMeshVertex** VertexBuffer);
|
||||||
void AddIndices(lcMeshDataType MeshDataType, lcMeshPrimitiveType PrimitiveType, lcuint32 ColorCode, int IndexCount, lcuint32** IndexBuffer);
|
void AddIndices(lcMeshDataType MeshDataType, lcMeshPrimitiveType PrimitiveType, quint32 ColorCode, int IndexCount, quint32** IndexBuffer);
|
||||||
void AddLine(lcMeshDataType MeshDataType, int LineType, lcuint32 ColorCode, bool WindingCCW, const lcVector3* Vertices, bool Optimize);
|
void AddLine(lcMeshDataType MeshDataType, int LineType, quint32 ColorCode, bool WindingCCW, const lcVector3* Vertices, bool Optimize);
|
||||||
void AddTexturedLine(lcMeshDataType MeshDataType, int LineType, lcuint32 ColorCode, bool WindingCCW, const lcLibraryTextureMap& Map, const lcVector3* Vertices, bool Optimize);
|
void AddTexturedLine(lcMeshDataType MeshDataType, int LineType, quint32 ColorCode, bool WindingCCW, const lcLibraryTextureMap& Map, const lcVector3* Vertices, bool Optimize);
|
||||||
void AddMeshData(const lcLibraryMeshData& Data, const lcMatrix44& Transform, lcuint32 CurrentColorCode, bool InvertWinding, bool InvertNormals, lcLibraryTextureMap* TextureMap, lcMeshDataType OverrideDestIndex);
|
void AddMeshData(const lcLibraryMeshData& Data, const lcMatrix44& Transform, quint32 CurrentColorCode, bool InvertWinding, bool InvertNormals, lcLibraryTextureMap* TextureMap, lcMeshDataType OverrideDestIndex);
|
||||||
void AddMeshDataNoDuplicateCheck(const lcLibraryMeshData& Data, const lcMatrix44& Transform, lcuint32 CurrentColorCode, bool InvertWinding, bool InvertNormals, lcLibraryTextureMap* TextureMap, lcMeshDataType OverrideDestIndex);
|
void AddMeshDataNoDuplicateCheck(const lcLibraryMeshData& Data, const lcMatrix44& Transform, quint32 CurrentColorCode, bool InvertWinding, bool InvertNormals, lcLibraryTextureMap* TextureMap, lcMeshDataType OverrideDestIndex);
|
||||||
void TestQuad(int* QuadIndices, const lcVector3* Vertices);
|
void TestQuad(int* QuadIndices, const lcVector3* Vertices);
|
||||||
void ResequenceQuad(int* QuadIndices, int a, int b, int c, int d);
|
void ResequenceQuad(int* QuadIndices, int a, int b, int c, int d);
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ public:
|
||||||
class lcLibraryPrimitive
|
class lcLibraryPrimitive
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
lcLibraryPrimitive(const char* Name, lcZipFileType ZipFileType,lcuint32 ZipFileIndex, bool Stud, bool SubFile)
|
lcLibraryPrimitive(const char* Name, lcZipFileType ZipFileType,quint32 ZipFileIndex, bool Stud, bool SubFile)
|
||||||
{
|
{
|
||||||
strncpy(mName, Name, sizeof(mName));
|
strncpy(mName, Name, sizeof(mName));
|
||||||
mName[sizeof(mName) - 1] = 0;
|
mName[sizeof(mName) - 1] = 0;
|
||||||
|
@ -139,7 +139,7 @@ public:
|
||||||
mSubFile = SubFile;
|
mSubFile = SubFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetZipFile(lcZipFileType ZipFileType,lcuint32 ZipFileIndex)
|
void SetZipFile(lcZipFileType ZipFileType,quint32 ZipFileIndex)
|
||||||
{
|
{
|
||||||
mZipFileType = ZipFileType;
|
mZipFileType = ZipFileType;
|
||||||
mZipFileIndex = ZipFileIndex;
|
mZipFileIndex = ZipFileIndex;
|
||||||
|
@ -147,7 +147,7 @@ public:
|
||||||
|
|
||||||
char mName[LC_MAXPATH];
|
char mName[LC_MAXPATH];
|
||||||
lcZipFileType mZipFileType;
|
lcZipFileType mZipFileType;
|
||||||
lcuint32 mZipFileIndex;
|
quint32 mZipFileIndex;
|
||||||
lcPrimitiveState mState;
|
lcPrimitiveState mState;
|
||||||
bool mStud;
|
bool mStud;
|
||||||
bool mSubFile;
|
bool mSubFile;
|
||||||
|
@ -197,7 +197,7 @@ public:
|
||||||
mNumOfficialPieces = mPieces.size();
|
mNumOfficialPieces = mPieces.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReadMeshData(lcFile& File, const lcMatrix44& CurrentTransform, lcuint32 CurrentColorCode, bool InvertWinding, lcArray<lcLibraryTextureMap>& TextureStack, lcLibraryMeshData& MeshData, lcMeshDataType MeshDataType, bool Optimize, Project* CurrentProject, bool SearchProjectFolder);
|
bool ReadMeshData(lcFile& File, const lcMatrix44& CurrentTransform, quint32 CurrentColorCode, bool InvertWinding, lcArray<lcLibraryTextureMap>& TextureStack, lcLibraryMeshData& MeshData, lcMeshDataType MeshDataType, bool Optimize, Project* CurrentProject, bool SearchProjectFolder);
|
||||||
lcMesh* CreateMesh(PieceInfo* Info, lcLibraryMeshData& MeshData);
|
lcMesh* CreateMesh(PieceInfo* Info, lcLibraryMeshData& MeshData);
|
||||||
void ReleaseBuffers(lcContext* Context);
|
void ReleaseBuffers(lcContext* Context);
|
||||||
void UpdateBuffers(lcContext* Context);
|
void UpdateBuffers(lcContext* Context);
|
||||||
|
|
|
@ -9,11 +9,11 @@
|
||||||
#define LC_2PI (static_cast<float>(2 * M_PI))
|
#define LC_2PI (static_cast<float>(2 * M_PI))
|
||||||
|
|
||||||
#define LC_RGB(r,g,b) LC_RGBA(r,g,b,255)
|
#define LC_RGB(r,g,b) LC_RGBA(r,g,b,255)
|
||||||
#define LC_RGBA(r,g,b,a) ((lcuint32)(((lcuint8) (r) | ((lcuint16) (g) << 8)) | (((lcuint32) (lcuint8) (b)) << 16) | (((lcuint32) (lcuint8) (a)) << 24)))
|
#define LC_RGBA(r,g,b,a) ((quint32)(((quint8) (r) | ((quint16) (g) << 8)) | (((quint32) (quint8) (b)) << 16) | (((quint32) (quint8) (a)) << 24)))
|
||||||
#define LC_RGBA_RED(rgba) ((lcuint8)(((rgba) >> 0) & 0xff))
|
#define LC_RGBA_RED(rgba) ((quint8)(((rgba) >> 0) & 0xff))
|
||||||
#define LC_RGBA_GREEN(rgba) ((lcuint8)(((rgba) >> 8) & 0xff))
|
#define LC_RGBA_GREEN(rgba) ((quint8)(((rgba) >> 8) & 0xff))
|
||||||
#define LC_RGBA_BLUE(rgba) ((lcuint8)(((rgba) >> 16) & 0xff))
|
#define LC_RGBA_BLUE(rgba) ((quint8)(((rgba) >> 16) & 0xff))
|
||||||
#define LC_RGBA_ALPHA(rgba) ((lcuint8)(((rgba) >> 24) & 0xff))
|
#define LC_RGBA_ALPHA(rgba) ((quint8)(((rgba) >> 24) & 0xff))
|
||||||
#define LC_FLOATRGB(f) LC_RGB(f[0]*255, f[1]*255, f[2]*255)
|
#define LC_FLOATRGB(f) LC_RGB(f[0]*255, f[1]*255, f[2]*255)
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -576,21 +576,21 @@ inline lcVector3 lcVector3LDrawToLeoCAD(const lcVector3& Vector)
|
||||||
return lcVector3(Vector[0], Vector[2], -Vector[1]);
|
return lcVector3(Vector[0], Vector[2], -Vector[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline lcVector3 lcVector3FromColor(lcuint32 Color)
|
inline lcVector3 lcVector3FromColor(quint32 Color)
|
||||||
{
|
{
|
||||||
lcVector3 v(LC_RGBA_RED(Color), LC_RGBA_GREEN(Color), LC_RGBA_BLUE(Color));
|
lcVector3 v(LC_RGBA_RED(Color), LC_RGBA_GREEN(Color), LC_RGBA_BLUE(Color));
|
||||||
v /= 255.0f;
|
v /= 255.0f;
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline lcVector4 lcVector4FromColor(lcuint32 Color)
|
inline lcVector4 lcVector4FromColor(quint32 Color)
|
||||||
{
|
{
|
||||||
lcVector4 v(LC_RGBA_RED(Color), LC_RGBA_GREEN(Color), LC_RGBA_BLUE(Color), LC_RGBA_ALPHA(Color));
|
lcVector4 v(LC_RGBA_RED(Color), LC_RGBA_GREEN(Color), LC_RGBA_BLUE(Color), LC_RGBA_ALPHA(Color));
|
||||||
v /= 255.0f;
|
v /= 255.0f;
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline lcuint32 lcColorFromVector3(const lcVector3& Color)
|
inline quint32 lcColorFromVector3(const lcVector3& Color)
|
||||||
{
|
{
|
||||||
return LC_RGB(Color[0] * 255, Color[1] * 255, Color[2] * 255);
|
return LC_RGB(Color[0] * 255, Color[1] * 255, Color[2] * 255);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ lcMesh::~lcMesh()
|
||||||
delete[] mLods[LodIdx].Sections;
|
delete[] mLods[LodIdx].Sections;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcMesh::Create(lcuint16 NumSections[LC_NUM_MESH_LODS], int NumVertices, int NumTexturedVertices, int NumIndices)
|
void lcMesh::Create(quint16 NumSections[LC_NUM_MESH_LODS], int NumVertices, int NumTexturedVertices, int NumIndices)
|
||||||
{
|
{
|
||||||
for (int LodIdx = 0; LodIdx < LC_NUM_MESH_LODS; LodIdx++)
|
for (int LodIdx = 0; LodIdx < LC_NUM_MESH_LODS; LodIdx++)
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,7 @@ void lcMesh::Create(lcuint16 NumSections[LC_NUM_MESH_LODS], int NumVertices, int
|
||||||
|
|
||||||
void lcMesh::CreateBox()
|
void lcMesh::CreateBox()
|
||||||
{
|
{
|
||||||
lcuint16 NumSections[LC_NUM_MESH_LODS];
|
quint16 NumSections[LC_NUM_MESH_LODS];
|
||||||
memset(NumSections, 0, sizeof(NumSections));
|
memset(NumSections, 0, sizeof(NumSections));
|
||||||
NumSections[LC_MESH_LOD_HIGH] = 2;
|
NumSections[LC_MESH_LOD_HIGH] = 2;
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ void lcMesh::CreateBox()
|
||||||
mBoundingBox.Max = Max;
|
mBoundingBox.Max = Max;
|
||||||
|
|
||||||
lcVertex* Verts = (lcVertex*)mVertexData;
|
lcVertex* Verts = (lcVertex*)mVertexData;
|
||||||
lcuint16* Indices = (lcuint16*)mIndexData;
|
quint16* Indices = (quint16*)mIndexData;
|
||||||
|
|
||||||
Verts[0].Position = lcVector3(Min[0], Min[1], Min[2]);
|
Verts[0].Position = lcVector3(Min[0], Min[1], Min[2]);
|
||||||
Verts[0].Normal = lcPackNormal(lcVector3(0.0f, 0.0f, -1.0f));
|
Verts[0].Normal = lcPackNormal(lcVector3(0.0f, 0.0f, -1.0f));
|
||||||
|
@ -369,8 +369,8 @@ bool lcMesh::FileLoad(lcMemFile& File)
|
||||||
mBoundingBox.Max = File.ReadVector3();
|
mBoundingBox.Max = File.ReadVector3();
|
||||||
mRadius = File.ReadFloat();
|
mRadius = File.ReadFloat();
|
||||||
|
|
||||||
lcuint32 NumVertices, NumTexturedVertices, NumIndices;
|
quint32 NumVertices, NumTexturedVertices, NumIndices;
|
||||||
lcuint16 NumLods, NumSections[LC_NUM_MESH_LODS];
|
quint16 NumLods, NumSections[LC_NUM_MESH_LODS];
|
||||||
|
|
||||||
if (!File.ReadU32(&NumVertices, 1) || !File.ReadU32(&NumTexturedVertices, 1) || !File.ReadU32(&NumIndices, 1))
|
if (!File.ReadU32(&NumVertices, 1) || !File.ReadU32(&NumTexturedVertices, 1) || !File.ReadU32(&NumIndices, 1))
|
||||||
return false;
|
return false;
|
||||||
|
@ -386,8 +386,8 @@ bool lcMesh::FileLoad(lcMemFile& File)
|
||||||
{
|
{
|
||||||
lcMeshSection& Section = mLods[LodIdx].Sections[SectionIdx];
|
lcMeshSection& Section = mLods[LodIdx].Sections[SectionIdx];
|
||||||
|
|
||||||
lcuint32 ColorCode, IndexOffset;
|
quint32 ColorCode, IndexOffset;
|
||||||
lcuint16 PrimtiveType, Length;
|
quint16 PrimtiveType, Length;
|
||||||
|
|
||||||
if (!File.ReadU32(&ColorCode, 1) || !File.ReadU32(&IndexOffset, 1) || !File.ReadU32(&NumIndices, 1) || !File.ReadU16(&PrimtiveType, 1))
|
if (!File.ReadU32(&ColorCode, 1) || !File.ReadU32(&IndexOffset, 1) || !File.ReadU32(&NumIndices, 1) || !File.ReadU16(&PrimtiveType, 1))
|
||||||
return false;
|
return false;
|
||||||
|
@ -419,9 +419,9 @@ bool lcMesh::FileLoad(lcMemFile& File)
|
||||||
|
|
||||||
File.ReadBuffer(mVertexData, mNumVertices * sizeof(lcVertex) + mNumTexturedVertices * sizeof(lcVertexTextured));
|
File.ReadBuffer(mVertexData, mNumVertices * sizeof(lcVertex) + mNumTexturedVertices * sizeof(lcVertexTextured));
|
||||||
if (mIndexType == GL_UNSIGNED_SHORT)
|
if (mIndexType == GL_UNSIGNED_SHORT)
|
||||||
File.ReadU16((lcuint16*)mIndexData, mIndexDataSize / 2);
|
File.ReadU16((quint16*)mIndexData, mIndexDataSize / 2);
|
||||||
else
|
else
|
||||||
File.ReadU32((lcuint32*)mIndexData, mIndexDataSize / 4);
|
File.ReadU32((quint32*)mIndexData, mIndexDataSize / 4);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -456,7 +456,7 @@ bool lcMesh::FileSave(lcMemFile& File)
|
||||||
|
|
||||||
if (Section.Texture)
|
if (Section.Texture)
|
||||||
{
|
{
|
||||||
lcuint16 Length = (lcuint16)strlen(Section.Texture->mName);
|
quint16 Length = (quint16)strlen(Section.Texture->mName);
|
||||||
File.WriteU16(Length);
|
File.WriteU16(Length);
|
||||||
File.WriteBuffer(Section.Texture->mName, Length);
|
File.WriteBuffer(Section.Texture->mName, Length);
|
||||||
}
|
}
|
||||||
|
@ -467,9 +467,9 @@ bool lcMesh::FileSave(lcMemFile& File)
|
||||||
|
|
||||||
File.WriteBuffer(mVertexData, mNumVertices * sizeof(lcVertex) + mNumTexturedVertices * sizeof(lcVertexTextured));
|
File.WriteBuffer(mVertexData, mNumVertices * sizeof(lcVertex) + mNumTexturedVertices * sizeof(lcVertexTextured));
|
||||||
if (mIndexType == GL_UNSIGNED_SHORT)
|
if (mIndexType == GL_UNSIGNED_SHORT)
|
||||||
File.WriteU16((lcuint16*)mIndexData, mIndexDataSize / 2);
|
File.WriteU16((quint16*)mIndexData, mIndexDataSize / 2);
|
||||||
else
|
else
|
||||||
File.WriteU32((lcuint32*)mIndexData, mIndexDataSize / 4);
|
File.WriteU32((quint32*)mIndexData, mIndexDataSize / 4);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ public:
|
||||||
lcMesh();
|
lcMesh();
|
||||||
~lcMesh();
|
~lcMesh();
|
||||||
|
|
||||||
void Create(lcuint16 NumSections[LC_NUM_MESH_LODS], int NumVertices, int NumTexturedVertices, int NumIndices);
|
void Create(quint16 NumSections[LC_NUM_MESH_LODS], int NumVertices, int NumTexturedVertices, int NumIndices);
|
||||||
void CreateBox();
|
void CreateBox();
|
||||||
|
|
||||||
bool FileLoad(lcMemFile& File);
|
bool FileLoad(lcMemFile& File);
|
||||||
|
|
|
@ -668,12 +668,12 @@ void lcModel::LoadLDraw(QIODevice& Device, Project* Project)
|
||||||
|
|
||||||
bool lcModel::LoadBinary(lcFile* file)
|
bool lcModel::LoadBinary(lcFile* file)
|
||||||
{
|
{
|
||||||
lcint32 i, count;
|
qint32 i, count;
|
||||||
char id[32];
|
char id[32];
|
||||||
lcuint32 rgb;
|
quint32 rgb;
|
||||||
float fv = 0.4f;
|
float fv = 0.4f;
|
||||||
lcuint8 ch;
|
quint8 ch;
|
||||||
lcuint16 sh;
|
quint16 sh;
|
||||||
|
|
||||||
file->Seek(0, SEEK_SET);
|
file->Seek(0, SEEK_SET);
|
||||||
file->ReadBuffer(id, 32);
|
file->ReadBuffer(id, 32);
|
||||||
|
@ -728,7 +728,7 @@ bool lcModel::LoadBinary(lcFile* file)
|
||||||
{
|
{
|
||||||
char name[LC_PIECE_NAME_LEN];
|
char name[LC_PIECE_NAME_LEN];
|
||||||
lcVector3 pos, rot;
|
lcVector3 pos, rot;
|
||||||
lcuint8 color, step, group;
|
quint8 color, step, group;
|
||||||
|
|
||||||
file->ReadFloats(pos, 3);
|
file->ReadFloats(pos, 3);
|
||||||
file->ReadFloats(rot, 3);
|
file->ReadFloats(rot, 3);
|
||||||
|
@ -2606,7 +2606,7 @@ void lcModel::ScaleSelectedPieces(const float Scale, bool Update, bool Checkpoin
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lcPiece* Piece = (lcPiece*)Focus;
|
lcPiece* Piece = (lcPiece*)Focus;
|
||||||
lcuint32 Section = Piece->GetFocusSection();
|
quint32 Section = Piece->GetFocusSection();
|
||||||
|
|
||||||
if (Section >= LC_PIECE_SECTION_CONTROL_POINT_1 && Section <= LC_PIECE_SECTION_CONTROL_POINT_8)
|
if (Section >= LC_PIECE_SECTION_CONTROL_POINT_1 && Section <= LC_PIECE_SECTION_CONTROL_POINT_8)
|
||||||
{
|
{
|
||||||
|
@ -3213,7 +3213,7 @@ void lcModel::GetSelectionInformation(int* Flags, lcArray<lcObject*>& Selection,
|
||||||
{
|
{
|
||||||
*Flags |= LC_SEL_CAN_ADD_CONTROL_POINT;
|
*Flags |= LC_SEL_CAN_ADD_CONTROL_POINT;
|
||||||
|
|
||||||
lcuint32 Section = Piece->GetFocusSection();
|
quint32 Section = Piece->GetFocusSection();
|
||||||
|
|
||||||
if (Section >= LC_PIECE_SECTION_CONTROL_POINT_1 && Section <= LC_PIECE_SECTION_CONTROL_POINT_8 && Piece->GetControlPoints().GetSize() > 2)
|
if (Section >= LC_PIECE_SECTION_CONTROL_POINT_1 && Section <= LC_PIECE_SECTION_CONTROL_POINT_8 && Piece->GetControlPoints().GetSize() > 2)
|
||||||
*Flags |= LC_SEL_CAN_REMOVE_CONTROL_POINT;
|
*Flags |= LC_SEL_CAN_REMOVE_CONTROL_POINT;
|
||||||
|
@ -3348,7 +3348,7 @@ void lcModel::FocusOrDeselectObject(const lcObjectSection& ObjectSection)
|
||||||
{
|
{
|
||||||
lcObject* FocusObject = GetFocusObject();
|
lcObject* FocusObject = GetFocusObject();
|
||||||
lcObject* Object = ObjectSection.Object;
|
lcObject* Object = ObjectSection.Object;
|
||||||
lcuint32 Section = ObjectSection.Section;
|
quint32 Section = ObjectSection.Section;
|
||||||
|
|
||||||
if (Object)
|
if (Object)
|
||||||
{
|
{
|
||||||
|
@ -3389,7 +3389,7 @@ void lcModel::FocusOrDeselectObject(const lcObjectSection& ObjectSection)
|
||||||
gMainWindow->UpdateAllViews();
|
gMainWindow->UpdateAllViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcModel::ClearSelectionAndSetFocus(lcObject* Object, lcuint32 Section, bool EnableSelectionMode)
|
void lcModel::ClearSelectionAndSetFocus(lcObject* Object, quint32 Section, bool EnableSelectionMode)
|
||||||
{
|
{
|
||||||
ClearSelection(false);
|
ClearSelection(false);
|
||||||
|
|
||||||
|
@ -3418,7 +3418,7 @@ void lcModel::ClearSelectionAndSetFocus(const lcObjectSection& ObjectSection, bo
|
||||||
ClearSelectionAndSetFocus(ObjectSection.Object, ObjectSection.Section, EnableSelectionMode);
|
ClearSelectionAndSetFocus(ObjectSection.Object, ObjectSection.Section, EnableSelectionMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcModel::SetSelectionAndFocus(const lcArray<lcObject*>& Selection, lcObject* Focus, lcuint32 Section, bool EnableSelectionMode)
|
void lcModel::SetSelectionAndFocus(const lcArray<lcObject*>& Selection, lcObject* Focus, quint32 Section, bool EnableSelectionMode)
|
||||||
{
|
{
|
||||||
ClearSelection(false);
|
ClearSelection(false);
|
||||||
|
|
||||||
|
|
|
@ -258,9 +258,9 @@ public:
|
||||||
|
|
||||||
void FocusOrDeselectObject(const lcObjectSection& ObjectSection);
|
void FocusOrDeselectObject(const lcObjectSection& ObjectSection);
|
||||||
void ClearSelection(bool UpdateInterface);
|
void ClearSelection(bool UpdateInterface);
|
||||||
void ClearSelectionAndSetFocus(lcObject* Object, lcuint32 Section, bool EnableSelectionMode);
|
void ClearSelectionAndSetFocus(lcObject* Object, quint32 Section, bool EnableSelectionMode);
|
||||||
void ClearSelectionAndSetFocus(const lcObjectSection& ObjectSection, bool EnableSelectionMode);
|
void ClearSelectionAndSetFocus(const lcObjectSection& ObjectSection, bool EnableSelectionMode);
|
||||||
void SetSelectionAndFocus(const lcArray<lcObject*>& Selection, lcObject* Focus, lcuint32 Section, bool EnableSelectionMode);
|
void SetSelectionAndFocus(const lcArray<lcObject*>& Selection, lcObject* Focus, quint32 Section, bool EnableSelectionMode);
|
||||||
void AddToSelection(const lcArray<lcObject*>& Objects, bool EnableSelectionMode, bool UpdateInterface);
|
void AddToSelection(const lcArray<lcObject*>& Objects, bool EnableSelectionMode, bool UpdateInterface);
|
||||||
void RemoveFromSelection(const lcArray<lcObject*>& Objects);
|
void RemoveFromSelection(const lcArray<lcObject*>& Objects);
|
||||||
void RemoveFromSelection(const lcObjectSection& ObjectSection);
|
void RemoveFromSelection(const lcObjectSection& ObjectSection);
|
||||||
|
|
|
@ -143,7 +143,7 @@ void lcScene::DrawRenderMeshes(lcContext* Context, int PrimitiveTypes, bool Enab
|
||||||
|
|
||||||
if (Mesh->mIndexType == GL_UNSIGNED_SHORT)
|
if (Mesh->mIndexType == GL_UNSIGNED_SHORT)
|
||||||
{
|
{
|
||||||
lcuint16* Indices = (lcuint16*)((char*)Mesh->mIndexData + Section->IndexOffset);
|
quint16* Indices = (quint16*)((char*)Mesh->mIndexData + Section->IndexOffset);
|
||||||
|
|
||||||
for (int i = 0; i < Section->NumIndices; i += 4)
|
for (int i = 0; i < Section->NumIndices; i += 4)
|
||||||
{
|
{
|
||||||
|
@ -153,12 +153,12 @@ void lcScene::DrawRenderMeshes(lcContext* Context, int PrimitiveTypes, bool Enab
|
||||||
lcVector3 p4 = lcMul31(VertexBuffer[Indices[i + 3]].Position, WorldViewProjectionMatrix);
|
lcVector3 p4 = lcMul31(VertexBuffer[Indices[i + 3]].Position, WorldViewProjectionMatrix);
|
||||||
|
|
||||||
if (((p1.y - p2.y) * (p3.x - p1.x) + (p2.x - p1.x) * (p3.y - p1.y)) * ((p1.y - p2.y) * (p4.x - p1.x) + (p2.x - p1.x) * (p4.y - p1.y)) >= 0)
|
if (((p1.y - p2.y) * (p3.x - p1.x) + (p2.x - p1.x) * (p3.y - p1.y)) * ((p1.y - p2.y) * (p4.x - p1.x) + (p2.x - p1.x) * (p4.y - p1.y)) >= 0)
|
||||||
Context->DrawIndexedPrimitives(GL_LINES, 2, Mesh->mIndexType, IndexBufferOffset + Section->IndexOffset + i * sizeof(lcuint16));
|
Context->DrawIndexedPrimitives(GL_LINES, 2, Mesh->mIndexType, IndexBufferOffset + Section->IndexOffset + i * sizeof(quint16));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lcuint32* Indices = (lcuint32*)((char*)Mesh->mIndexData + Section->IndexOffset);
|
quint32* Indices = (quint32*)((char*)Mesh->mIndexData + Section->IndexOffset);
|
||||||
|
|
||||||
for (int i = 0; i < Section->NumIndices; i += 4)
|
for (int i = 0; i < Section->NumIndices; i += 4)
|
||||||
{
|
{
|
||||||
|
@ -168,7 +168,7 @@ void lcScene::DrawRenderMeshes(lcContext* Context, int PrimitiveTypes, bool Enab
|
||||||
lcVector3 p4 = lcMul31(VertexBuffer[Indices[i + 3]].Position, WorldViewProjectionMatrix);
|
lcVector3 p4 = lcMul31(VertexBuffer[Indices[i + 3]].Position, WorldViewProjectionMatrix);
|
||||||
|
|
||||||
if (((p1.y - p2.y) * (p3.x - p1.x) + (p2.x - p1.x) * (p3.y - p1.y)) * ((p1.y - p2.y) * (p4.x - p1.x) + (p2.x - p1.x) * (p4.y - p1.y)) >= 0)
|
if (((p1.y - p2.y) * (p3.x - p1.x) + (p2.x - p1.x) * (p3.y - p1.y)) * ((p1.y - p2.y) * (p4.x - p1.x) + (p2.x - p1.x) * (p4.y - p1.y)) >= 0)
|
||||||
Context->DrawIndexedPrimitives(GL_LINES, 2, Mesh->mIndexType, IndexBufferOffset + Section->IndexOffset + i * sizeof(lcuint32));
|
Context->DrawIndexedPrimitives(GL_LINES, 2, Mesh->mIndexType, IndexBufferOffset + Section->IndexOffset + i * sizeof(quint32));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -427,7 +427,7 @@ void lcSynthInfo::AddFlexibleAxleParts(lcMemFile& File, lcLibraryMeshData& MeshD
|
||||||
|
|
||||||
int BaseVertex;
|
int BaseVertex;
|
||||||
lcLibraryMeshVertex* VertexBuffer;
|
lcLibraryMeshVertex* VertexBuffer;
|
||||||
lcuint32* IndexBuffer;
|
quint32* IndexBuffer;
|
||||||
MeshData.AddVertices(LC_MESHDATA_SHARED, 16 * (Sections.GetSize() - 1), &BaseVertex, &VertexBuffer);
|
MeshData.AddVertices(LC_MESHDATA_SHARED, 16 * (Sections.GetSize() - 1), &BaseVertex, &VertexBuffer);
|
||||||
MeshData.AddIndices(LC_MESHDATA_SHARED, LC_MESH_LINES, 24, 2 * 12 * (Sections.GetSize() - 2), &IndexBuffer);
|
MeshData.AddIndices(LC_MESHDATA_SHARED, LC_MESH_LINES, 24, 2 * 12 * (Sections.GetSize() - 2), &IndexBuffer);
|
||||||
|
|
||||||
|
@ -506,7 +506,7 @@ void lcSynthInfo::AddStringBraidedParts(lcMemFile& File, lcLibraryMeshData& Mesh
|
||||||
|
|
||||||
int BaseVertex;
|
int BaseVertex;
|
||||||
lcLibraryMeshVertex* VertexBuffer;
|
lcLibraryMeshVertex* VertexBuffer;
|
||||||
lcuint32* IndexBuffer;
|
quint32* IndexBuffer;
|
||||||
MeshData.AddVertices(LC_MESHDATA_SHARED, NumBraids * ((Sections.GetSize() - 2) * NumSegments + 1), &BaseVertex, &VertexBuffer);
|
MeshData.AddVertices(LC_MESHDATA_SHARED, NumBraids * ((Sections.GetSize() - 2) * NumSegments + 1), &BaseVertex, &VertexBuffer);
|
||||||
MeshData.AddIndices(LC_MESHDATA_SHARED, LC_MESH_LINES, 24, NumBraids * (Sections.GetSize() - 2) * NumSegments * 2, &IndexBuffer);
|
MeshData.AddIndices(LC_MESHDATA_SHARED, LC_MESH_LINES, 24, NumBraids * (Sections.GetSize() - 2) * NumSegments * 2, &IndexBuffer);
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ void lcTexture::CreateGridTexture()
|
||||||
{
|
{
|
||||||
const int NumLevels = 9;
|
const int NumLevels = 9;
|
||||||
Image GridImages[NumLevels];
|
Image GridImages[NumLevels];
|
||||||
lcuint8* Previous = nullptr;
|
quint8* Previous = nullptr;
|
||||||
|
|
||||||
for (int ImageLevel = 0; ImageLevel < NumLevels; ImageLevel++)
|
for (int ImageLevel = 0; ImageLevel < NumLevels; ImageLevel++)
|
||||||
{
|
{
|
||||||
|
@ -63,24 +63,24 @@ void lcTexture::CreateGridTexture()
|
||||||
{
|
{
|
||||||
for (int x = 0; x < GridSize - 1; x++)
|
for (int x = 0; x < GridSize - 1; x++)
|
||||||
{
|
{
|
||||||
lcuint8 a = Previous[x * 2 + y * 2 * PreviousGridSize] > 64 ? 255 : 0;
|
quint8 a = Previous[x * 2 + y * 2 * PreviousGridSize] > 64 ? 255 : 0;
|
||||||
lcuint8 b = Previous[x * 2 + 1 + y * 2 * PreviousGridSize] > 64 ? 255 : 0;
|
quint8 b = Previous[x * 2 + 1 + y * 2 * PreviousGridSize] > 64 ? 255 : 0;
|
||||||
lcuint8 c = Previous[x * 2 + (y * 2 + 1) * PreviousGridSize] > 64 ? 255 : 0;
|
quint8 c = Previous[x * 2 + (y * 2 + 1) * PreviousGridSize] > 64 ? 255 : 0;
|
||||||
lcuint8 d = Previous[x * 2 + 1 + (y * 2 + 1) * PreviousGridSize] > 64 ? 255 : 0;
|
quint8 d = Previous[x * 2 + 1 + (y * 2 + 1) * PreviousGridSize] > 64 ? 255 : 0;
|
||||||
GridImage.mData[x + y * GridSize] = (a + b + c + d) / 4;
|
GridImage.mData[x + y * GridSize] = (a + b + c + d) / 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
int x = GridSize - 1;
|
int x = GridSize - 1;
|
||||||
lcuint8 a = Previous[x * 2 + y * 2 * PreviousGridSize];
|
quint8 a = Previous[x * 2 + y * 2 * PreviousGridSize];
|
||||||
lcuint8 c = Previous[x * 2 + (y * 2 + 1) * PreviousGridSize];
|
quint8 c = Previous[x * 2 + (y * 2 + 1) * PreviousGridSize];
|
||||||
GridImage.mData[x + y * GridSize] = (a + c) / 2;
|
GridImage.mData[x + y * GridSize] = (a + c) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
int y = GridSize - 1;
|
int y = GridSize - 1;
|
||||||
for (int x = 0; x < GridSize - 1; x++)
|
for (int x = 0; x < GridSize - 1; x++)
|
||||||
{
|
{
|
||||||
lcuint8 a = Previous[x * 2 + y * 2 * PreviousGridSize];
|
quint8 a = Previous[x * 2 + y * 2 * PreviousGridSize];
|
||||||
lcuint8 b = Previous[x * 2 + 1 + y * 2 * PreviousGridSize];
|
quint8 b = Previous[x * 2 + 1 + y * 2 * PreviousGridSize];
|
||||||
GridImage.mData[x + y * GridSize] = (a + b) / 2;
|
GridImage.mData[x + y * GridSize] = (a + b) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,11 +91,11 @@ void lcTexture::CreateGridTexture()
|
||||||
{
|
{
|
||||||
const float Radius1 = (80 >> ImageLevel) * (80 >> ImageLevel);
|
const float Radius1 = (80 >> ImageLevel) * (80 >> ImageLevel);
|
||||||
const float Radius2 = (72 >> ImageLevel) * (72 >> ImageLevel);
|
const float Radius2 = (72 >> ImageLevel) * (72 >> ImageLevel);
|
||||||
lcuint8* TempBuffer = new lcuint8[GridSize * GridSize];
|
quint8* TempBuffer = new quint8[GridSize * GridSize];
|
||||||
|
|
||||||
for (int y = 0; y < GridSize; y++)
|
for (int y = 0; y < GridSize; y++)
|
||||||
{
|
{
|
||||||
lcuint8* Pixel = TempBuffer + y * GridSize;
|
quint8* Pixel = TempBuffer + y * GridSize;
|
||||||
memset(Pixel, 0, GridSize);
|
memset(Pixel, 0, GridSize);
|
||||||
|
|
||||||
const float y2 = (y - GridSize / 2) * (y - GridSize / 2);
|
const float y2 = (y - GridSize / 2) * (y - GridSize / 2);
|
||||||
|
@ -127,24 +127,24 @@ void lcTexture::CreateGridTexture()
|
||||||
{
|
{
|
||||||
for (int x = 0; x < GridSize - 1; x++)
|
for (int x = 0; x < GridSize - 1; x++)
|
||||||
{
|
{
|
||||||
lcuint8 a = TempBuffer[x + y * GridSize];
|
quint8 a = TempBuffer[x + y * GridSize];
|
||||||
lcuint8 b = TempBuffer[x + 1 + y * GridSize];
|
quint8 b = TempBuffer[x + 1 + y * GridSize];
|
||||||
lcuint8 c = TempBuffer[x + (y + 1) * GridSize];
|
quint8 c = TempBuffer[x + (y + 1) * GridSize];
|
||||||
lcuint8 d = TempBuffer[x + 1 + (y + 1) * GridSize];
|
quint8 d = TempBuffer[x + 1 + (y + 1) * GridSize];
|
||||||
GridImage.mData[x + y * GridSize] = (a + b + c + d) / 4;
|
GridImage.mData[x + y * GridSize] = (a + b + c + d) / 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
int x = GridSize - 1;
|
int x = GridSize - 1;
|
||||||
lcuint8 a = TempBuffer[x + y * GridSize];
|
quint8 a = TempBuffer[x + y * GridSize];
|
||||||
lcuint8 c = TempBuffer[x + (y + 1) * GridSize];
|
quint8 c = TempBuffer[x + (y + 1) * GridSize];
|
||||||
GridImage.mData[x + y * GridSize] = (a + c) / 2;
|
GridImage.mData[x + y * GridSize] = (a + c) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
int y = GridSize - 1;
|
int y = GridSize - 1;
|
||||||
for (int x = 0; x < GridSize - 1; x++)
|
for (int x = 0; x < GridSize - 1; x++)
|
||||||
{
|
{
|
||||||
lcuint8 a = TempBuffer[x + y * GridSize];
|
quint8 a = TempBuffer[x + y * GridSize];
|
||||||
lcuint8 b = TempBuffer[x + 1 + y * GridSize];
|
quint8 b = TempBuffer[x + 1 + y * GridSize];
|
||||||
GridImage.mData[x + y * GridSize] = (a + b) / 2;
|
GridImage.mData[x + y * GridSize] = (a + b) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,11 +71,11 @@ bool lcZipFile::OpenWrite(const QString& FileName)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
lcuint64 lcZipFile::SearchCentralDir()
|
quint64 lcZipFile::SearchCentralDir()
|
||||||
{
|
{
|
||||||
lcuint64 SizeFile, MaxBack, BackRead, PosFound;
|
quint64 SizeFile, MaxBack, BackRead, PosFound;
|
||||||
const int CommentBufferSize = 1024;
|
const int CommentBufferSize = 1024;
|
||||||
lcuint8 buf[CommentBufferSize + 4];
|
quint8 buf[CommentBufferSize + 4];
|
||||||
|
|
||||||
SizeFile = mFile->GetLength();
|
SizeFile = mFile->GetLength();
|
||||||
MaxBack = lcMin(SizeFile, 0xffffULL);
|
MaxBack = lcMin(SizeFile, 0xffffULL);
|
||||||
|
@ -84,7 +84,7 @@ lcuint64 lcZipFile::SearchCentralDir()
|
||||||
|
|
||||||
while (BackRead < MaxBack)
|
while (BackRead < MaxBack)
|
||||||
{
|
{
|
||||||
lcuint64 ReadPos, ReadSize;
|
quint64 ReadPos, ReadSize;
|
||||||
|
|
||||||
if (BackRead + CommentBufferSize > MaxBack)
|
if (BackRead + CommentBufferSize > MaxBack)
|
||||||
BackRead = MaxBack;
|
BackRead = MaxBack;
|
||||||
|
@ -114,11 +114,11 @@ lcuint64 lcZipFile::SearchCentralDir()
|
||||||
return PosFound;
|
return PosFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
lcuint64 lcZipFile::SearchCentralDir64()
|
quint64 lcZipFile::SearchCentralDir64()
|
||||||
{
|
{
|
||||||
lcuint64 SizeFile, MaxBack, BackRead, PosFound;
|
quint64 SizeFile, MaxBack, BackRead, PosFound;
|
||||||
const int CommentBufferSize = 1024;
|
const int CommentBufferSize = 1024;
|
||||||
lcuint8 buf[CommentBufferSize + 4];
|
quint8 buf[CommentBufferSize + 4];
|
||||||
|
|
||||||
SizeFile = mFile->GetLength();
|
SizeFile = mFile->GetLength();
|
||||||
MaxBack = lcMin(SizeFile, 0xffffULL);
|
MaxBack = lcMin(SizeFile, 0xffffULL);
|
||||||
|
@ -127,7 +127,7 @@ lcuint64 lcZipFile::SearchCentralDir64()
|
||||||
|
|
||||||
while (BackRead < MaxBack)
|
while (BackRead < MaxBack)
|
||||||
{
|
{
|
||||||
lcuint64 ReadPos, ReadSize;
|
quint64 ReadPos, ReadSize;
|
||||||
|
|
||||||
if (BackRead + CommentBufferSize > MaxBack)
|
if (BackRead + CommentBufferSize > MaxBack)
|
||||||
BackRead = MaxBack;
|
BackRead = MaxBack;
|
||||||
|
@ -159,8 +159,8 @@ lcuint64 lcZipFile::SearchCentralDir64()
|
||||||
|
|
||||||
mFile->Seek((long)PosFound, SEEK_SET);
|
mFile->Seek((long)PosFound, SEEK_SET);
|
||||||
|
|
||||||
lcuint32 Number;
|
quint32 Number;
|
||||||
lcuint64 RelativeOffset;
|
quint64 RelativeOffset;
|
||||||
|
|
||||||
// Signature.
|
// Signature.
|
||||||
if (mFile->ReadU32(&Number, 1) != 1)
|
if (mFile->ReadU32(&Number, 1) != 1)
|
||||||
|
@ -197,11 +197,11 @@ lcuint64 lcZipFile::SearchCentralDir64()
|
||||||
return RelativeOffset;
|
return RelativeOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool lcZipFile::CheckFileCoherencyHeader(int FileIndex, lcuint32* SizeVar, lcuint64* OffsetLocalExtraField, lcuint32* SizeLocalExtraField)
|
bool lcZipFile::CheckFileCoherencyHeader(int FileIndex, quint32* SizeVar, quint64* OffsetLocalExtraField, quint32* SizeLocalExtraField)
|
||||||
{
|
{
|
||||||
lcuint16 Number16, Flags;
|
quint16 Number16, Flags;
|
||||||
lcuint32 Number32, Magic;
|
quint32 Number32, Magic;
|
||||||
lcuint16 SizeFilename, SizeExtraField;
|
quint16 SizeFilename, SizeExtraField;
|
||||||
const lcZipFileInfo& FileInfo = mFiles[FileIndex];
|
const lcZipFileInfo& FileInfo = mFiles[FileIndex];
|
||||||
|
|
||||||
*SizeVar = 0;
|
*SizeVar = 0;
|
||||||
|
@ -255,13 +255,13 @@ bool lcZipFile::CheckFileCoherencyHeader(int FileIndex, lcuint32* SizeVar, lcuin
|
||||||
|
|
||||||
bool lcZipFile::Open()
|
bool lcZipFile::Open()
|
||||||
{
|
{
|
||||||
lcuint64 NumberEntriesCD, CentralPos;
|
quint64 NumberEntriesCD, CentralPos;
|
||||||
|
|
||||||
CentralPos = SearchCentralDir64();
|
CentralPos = SearchCentralDir64();
|
||||||
|
|
||||||
if (CentralPos)
|
if (CentralPos)
|
||||||
{
|
{
|
||||||
lcuint32 NumberDisk, NumberDiskWithCD;
|
quint32 NumberDisk, NumberDiskWithCD;
|
||||||
|
|
||||||
mZip64 = true;
|
mZip64 = true;
|
||||||
|
|
||||||
|
@ -299,9 +299,9 @@ bool lcZipFile::Open()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lcuint16 NumberDisk, NumberDiskWithCD;
|
quint16 NumberDisk, NumberDiskWithCD;
|
||||||
lcuint16 Number16;
|
quint16 Number16;
|
||||||
lcuint32 Number32;
|
quint32 Number32;
|
||||||
|
|
||||||
CentralPos = SearchCentralDir();
|
CentralPos = SearchCentralDir();
|
||||||
if (CentralPos == 0)
|
if (CentralPos == 0)
|
||||||
|
@ -359,14 +359,14 @@ bool lcZipFile::Open()
|
||||||
|
|
||||||
bool lcZipFile::ReadCentralDir()
|
bool lcZipFile::ReadCentralDir()
|
||||||
{
|
{
|
||||||
lcuint64 PosInCentralDir = mCentralDirOffset;
|
quint64 PosInCentralDir = mCentralDirOffset;
|
||||||
|
|
||||||
mFile->Seek((long)(PosInCentralDir + mBytesBeforeZipFile), SEEK_SET);
|
mFile->Seek((long)(PosInCentralDir + mBytesBeforeZipFile), SEEK_SET);
|
||||||
mFiles.AllocGrow((int)mNumEntries);
|
mFiles.AllocGrow((int)mNumEntries);
|
||||||
|
|
||||||
for (lcuint64 FileNum = 0; FileNum < mNumEntries; FileNum++)
|
for (quint64 FileNum = 0; FileNum < mNumEntries; FileNum++)
|
||||||
{
|
{
|
||||||
lcuint32 Magic, Number32;
|
quint32 Magic, Number32;
|
||||||
lcZipFileInfo& FileInfo = mFiles.Add();
|
lcZipFileInfo& FileInfo = mFiles.Add();
|
||||||
long Seek = 0;
|
long Seek = 0;
|
||||||
|
|
||||||
|
@ -391,14 +391,14 @@ bool lcZipFile::ReadCentralDir()
|
||||||
if (mFile->ReadU32(&FileInfo.dosDate, 1) != 1)
|
if (mFile->ReadU32(&FileInfo.dosDate, 1) != 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
lcuint32 Date = FileInfo.dosDate >> 16;
|
quint32 Date = FileInfo.dosDate >> 16;
|
||||||
FileInfo.tmu_date.tm_mday = (lcuint32)(Date & 0x1f);
|
FileInfo.tmu_date.tm_mday = (quint32)(Date & 0x1f);
|
||||||
FileInfo.tmu_date.tm_mon = (lcuint32)((((Date) & 0x1E0) / 0x20) - 1);
|
FileInfo.tmu_date.tm_mon = (quint32)((((Date) & 0x1E0) / 0x20) - 1);
|
||||||
FileInfo.tmu_date.tm_year = (lcuint32)(((Date & 0x0FE00) / 0x0200) + 1980);
|
FileInfo.tmu_date.tm_year = (quint32)(((Date & 0x0FE00) / 0x0200) + 1980);
|
||||||
|
|
||||||
FileInfo.tmu_date.tm_hour = (lcuint32)((FileInfo.dosDate & 0xF800) / 0x800);
|
FileInfo.tmu_date.tm_hour = (quint32)((FileInfo.dosDate & 0xF800) / 0x800);
|
||||||
FileInfo.tmu_date.tm_min = (lcuint32)((FileInfo.dosDate & 0x7E0) / 0x20);
|
FileInfo.tmu_date.tm_min = (quint32)((FileInfo.dosDate & 0x7E0) / 0x20);
|
||||||
FileInfo.tmu_date.tm_sec = (lcuint32)(2*(FileInfo.dosDate & 0x1f));
|
FileInfo.tmu_date.tm_sec = (quint32)(2*(FileInfo.dosDate & 0x1f));
|
||||||
|
|
||||||
if (mFile->ReadU32(&FileInfo.crc, 1) != 1)
|
if (mFile->ReadU32(&FileInfo.crc, 1) != 1)
|
||||||
return false;
|
return false;
|
||||||
|
@ -436,7 +436,7 @@ bool lcZipFile::ReadCentralDir()
|
||||||
|
|
||||||
Seek += FileInfo.size_filename;
|
Seek += FileInfo.size_filename;
|
||||||
|
|
||||||
lcuint32 SizeRead;
|
quint32 SizeRead;
|
||||||
if (FileInfo.size_filename < sizeof(FileInfo.file_name) - 1)
|
if (FileInfo.size_filename < sizeof(FileInfo.file_name) - 1)
|
||||||
{
|
{
|
||||||
*(FileInfo.file_name + FileInfo.size_filename) = '\0';
|
*(FileInfo.file_name + FileInfo.size_filename) = '\0';
|
||||||
|
@ -483,7 +483,7 @@ bool lcZipFile::ReadCentralDir()
|
||||||
|
|
||||||
if (FileInfo.size_file_extra != 0)
|
if (FileInfo.size_file_extra != 0)
|
||||||
{
|
{
|
||||||
lcuint32 acc = 0;
|
quint32 acc = 0;
|
||||||
|
|
||||||
// since lSeek now points to after the extra field we need to move back
|
// since lSeek now points to after the extra field we need to move back
|
||||||
Seek -= FileInfo.size_file_extra;
|
Seek -= FileInfo.size_file_extra;
|
||||||
|
@ -496,7 +496,7 @@ bool lcZipFile::ReadCentralDir()
|
||||||
|
|
||||||
while (acc < FileInfo.size_file_extra)
|
while (acc < FileInfo.size_file_extra)
|
||||||
{
|
{
|
||||||
lcuint16 HeaderId, DataSize;
|
quint16 HeaderId, DataSize;
|
||||||
|
|
||||||
if (mFile->ReadU16(&HeaderId, 1) != 1)
|
if (mFile->ReadU16(&HeaderId, 1) != 1)
|
||||||
return false;
|
return false;
|
||||||
|
@ -507,26 +507,26 @@ bool lcZipFile::ReadCentralDir()
|
||||||
// ZIP64 extra fields.
|
// ZIP64 extra fields.
|
||||||
if (HeaderId == 0x0001)
|
if (HeaderId == 0x0001)
|
||||||
{
|
{
|
||||||
if (FileInfo.uncompressed_size == (lcuint64)(unsigned long)-1)
|
if (FileInfo.uncompressed_size == (quint64)(unsigned long)-1)
|
||||||
{
|
{
|
||||||
if (mFile->ReadU64(&FileInfo.uncompressed_size, 1) != 1)
|
if (mFile->ReadU64(&FileInfo.uncompressed_size, 1) != 1)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FileInfo.compressed_size == (lcuint64)(unsigned long)-1)
|
if (FileInfo.compressed_size == (quint64)(unsigned long)-1)
|
||||||
{
|
{
|
||||||
if (mFile->ReadU64(&FileInfo.compressed_size, 1) != 1)
|
if (mFile->ReadU64(&FileInfo.compressed_size, 1) != 1)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FileInfo.offset_curfile == (lcuint64)-1)
|
if (FileInfo.offset_curfile == (quint64)-1)
|
||||||
{
|
{
|
||||||
// Relative Header offset.
|
// Relative Header offset.
|
||||||
if (mFile->ReadU64(&FileInfo.offset_curfile, 1) != 1)
|
if (mFile->ReadU64(&FileInfo.offset_curfile, 1) != 1)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FileInfo.disk_num_start == (lcuint16)-1)
|
if (FileInfo.disk_num_start == (quint16)-1)
|
||||||
{
|
{
|
||||||
// Disk Start Number.
|
// Disk Start Number.
|
||||||
if (mFile->ReadU32(&Number32, 1) != 1)
|
if (mFile->ReadU32(&Number32, 1) != 1)
|
||||||
|
@ -577,7 +577,7 @@ bool lcZipFile::ReadCentralDir()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool lcZipFile::ExtractFile(const char* FileName, lcMemFile& File, lcuint32 MaxLength)
|
bool lcZipFile::ExtractFile(const char* FileName, lcMemFile& File, quint32 MaxLength)
|
||||||
{
|
{
|
||||||
for (int FileIdx = 0; FileIdx < mFiles.GetSize(); FileIdx++)
|
for (int FileIdx = 0; FileIdx < mFiles.GetSize(); FileIdx++)
|
||||||
{
|
{
|
||||||
|
@ -590,13 +590,13 @@ bool lcZipFile::ExtractFile(const char* FileName, lcMemFile& File, lcuint32 MaxL
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool lcZipFile::ExtractFile(int FileIndex, lcMemFile& File, lcuint32 MaxLength)
|
bool lcZipFile::ExtractFile(int FileIndex, lcMemFile& File, quint32 MaxLength)
|
||||||
{
|
{
|
||||||
QMutexLocker Lock(&mMutex);
|
QMutexLocker Lock(&mMutex);
|
||||||
|
|
||||||
lcuint32 SizeVar;
|
quint32 SizeVar;
|
||||||
lcuint64 OffsetLocalExtraField;
|
quint64 OffsetLocalExtraField;
|
||||||
lcuint32 SizeLocalExtraField;
|
quint32 SizeLocalExtraField;
|
||||||
const lcZipFileInfo& FileInfo = mFiles[FileIndex];
|
const lcZipFileInfo& FileInfo = mFiles[FileIndex];
|
||||||
|
|
||||||
if (!CheckFileCoherencyHeader(FileIndex, &SizeVar, &OffsetLocalExtraField, &SizeLocalExtraField))
|
if (!CheckFileCoherencyHeader(FileIndex, &SizeVar, &OffsetLocalExtraField, &SizeLocalExtraField))
|
||||||
|
@ -605,10 +605,10 @@ bool lcZipFile::ExtractFile(int FileIndex, lcMemFile& File, lcuint32 MaxLength)
|
||||||
const int BufferSize = 16384;
|
const int BufferSize = 16384;
|
||||||
char ReadBuffer[BufferSize];
|
char ReadBuffer[BufferSize];
|
||||||
z_stream Stream;
|
z_stream Stream;
|
||||||
lcuint32 Crc32;
|
quint32 Crc32;
|
||||||
lcuint64 PosInZipfile;
|
quint64 PosInZipfile;
|
||||||
lcuint64 RestReadCompressed;
|
quint64 RestReadCompressed;
|
||||||
lcuint64 RestReadUncompressed;
|
quint64 RestReadUncompressed;
|
||||||
|
|
||||||
Crc32 = 0;
|
Crc32 = 0;
|
||||||
Stream.total_out = 0;
|
Stream.total_out = 0;
|
||||||
|
@ -632,23 +632,23 @@ bool lcZipFile::ExtractFile(int FileIndex, lcMemFile& File, lcuint32 MaxLength)
|
||||||
|
|
||||||
Stream.avail_in = (uInt)0;
|
Stream.avail_in = (uInt)0;
|
||||||
|
|
||||||
lcuint32 Length = lcMin((lcuint32)FileInfo.uncompressed_size, MaxLength);
|
quint32 Length = lcMin((quint32)FileInfo.uncompressed_size, MaxLength);
|
||||||
File.SetLength(Length);
|
File.SetLength(Length);
|
||||||
File.Seek(0, SEEK_SET);
|
File.Seek(0, SEEK_SET);
|
||||||
|
|
||||||
Stream.next_out = (Bytef*)File.mBuffer;
|
Stream.next_out = (Bytef*)File.mBuffer;
|
||||||
Stream.avail_out = Length;
|
Stream.avail_out = Length;
|
||||||
|
|
||||||
lcuint32 Read = 0;
|
quint32 Read = 0;
|
||||||
|
|
||||||
while (Stream.avail_out > 0)
|
while (Stream.avail_out > 0)
|
||||||
{
|
{
|
||||||
if ((Stream.avail_in == 0) && (RestReadCompressed > 0))
|
if ((Stream.avail_in == 0) && (RestReadCompressed > 0))
|
||||||
{
|
{
|
||||||
lcuint32 ReadThis = BufferSize;
|
quint32 ReadThis = BufferSize;
|
||||||
|
|
||||||
if (RestReadCompressed < ReadThis)
|
if (RestReadCompressed < ReadThis)
|
||||||
ReadThis = (lcuint32)RestReadCompressed;
|
ReadThis = (quint32)RestReadCompressed;
|
||||||
|
|
||||||
if (ReadThis == 0)
|
if (ReadThis == 0)
|
||||||
return false;
|
return false;
|
||||||
|
@ -667,7 +667,7 @@ bool lcZipFile::ExtractFile(int FileIndex, lcMemFile& File, lcuint32 MaxLength)
|
||||||
|
|
||||||
if (FileInfo.compression_method == 0)
|
if (FileInfo.compression_method == 0)
|
||||||
{
|
{
|
||||||
lcuint32 DoCopy, i;
|
quint32 DoCopy, i;
|
||||||
|
|
||||||
if ((Stream.avail_in == 0) && (RestReadCompressed == 0))
|
if ((Stream.avail_in == 0) && (RestReadCompressed == 0))
|
||||||
return (Read == 0) ? false : true;
|
return (Read == 0) ? false : true;
|
||||||
|
@ -691,9 +691,9 @@ bool lcZipFile::ExtractFile(int FileIndex, lcMemFile& File, lcuint32 MaxLength)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lcuint64 TotalOutBefore, TotalOutAfter;
|
quint64 TotalOutBefore, TotalOutAfter;
|
||||||
const Bytef *bufBefore;
|
const Bytef *bufBefore;
|
||||||
lcuint64 OutThis;
|
quint64 OutThis;
|
||||||
int flush = Z_SYNC_FLUSH;
|
int flush = Z_SYNC_FLUSH;
|
||||||
|
|
||||||
TotalOutBefore = Stream.total_out;
|
TotalOutBefore = Stream.total_out;
|
||||||
|
|
|
@ -11,34 +11,34 @@ class lcFile;
|
||||||
// Date/time info.
|
// Date/time info.
|
||||||
struct tm_unz
|
struct tm_unz
|
||||||
{
|
{
|
||||||
lcuint32 tm_sec; // seconds after the minute - [0,59]
|
quint32 tm_sec; // seconds after the minute - [0,59]
|
||||||
lcuint32 tm_min; // minutes after the hour - [0,59]
|
quint32 tm_min; // minutes after the hour - [0,59]
|
||||||
lcuint32 tm_hour; // hours since midnight - [0,23]
|
quint32 tm_hour; // hours since midnight - [0,23]
|
||||||
lcuint32 tm_mday; // day of the month - [1,31]
|
quint32 tm_mday; // day of the month - [1,31]
|
||||||
lcuint32 tm_mon; // months since January - [0,11]
|
quint32 tm_mon; // months since January - [0,11]
|
||||||
lcuint32 tm_year; // years - [1980..2044]
|
quint32 tm_year; // years - [1980..2044]
|
||||||
};
|
};
|
||||||
|
|
||||||
// Information about a file in the zipfile.
|
// Information about a file in the zipfile.
|
||||||
struct lcZipFileInfo
|
struct lcZipFileInfo
|
||||||
{
|
{
|
||||||
lcuint16 version; // version made by 2 bytes
|
quint16 version; // version made by 2 bytes
|
||||||
lcuint16 version_needed; // version needed to extract 2 bytes
|
quint16 version_needed; // version needed to extract 2 bytes
|
||||||
lcuint16 flag; // general purpose bit flag 2 bytes
|
quint16 flag; // general purpose bit flag 2 bytes
|
||||||
lcuint16 compression_method; // compression method 2 bytes
|
quint16 compression_method; // compression method 2 bytes
|
||||||
lcuint32 dosDate; // last mod file date in Dos fmt 4 bytes
|
quint32 dosDate; // last mod file date in Dos fmt 4 bytes
|
||||||
lcuint32 crc; // crc-32 4 bytes
|
quint32 crc; // crc-32 4 bytes
|
||||||
lcuint64 compressed_size; // compressed size 8 bytes
|
quint64 compressed_size; // compressed size 8 bytes
|
||||||
lcuint64 uncompressed_size; // uncompressed size 8 bytes
|
quint64 uncompressed_size; // uncompressed size 8 bytes
|
||||||
lcuint16 size_filename; // filename length 2 bytes
|
quint16 size_filename; // filename length 2 bytes
|
||||||
lcuint16 size_file_extra; // extra field length 2 bytes
|
quint16 size_file_extra; // extra field length 2 bytes
|
||||||
lcuint16 size_file_comment; // file comment length 2 bytes
|
quint16 size_file_comment; // file comment length 2 bytes
|
||||||
|
|
||||||
lcuint16 disk_num_start; // disk number start 2 bytes
|
quint16 disk_num_start; // disk number start 2 bytes
|
||||||
lcuint16 internal_fa; // internal file attributes 2 bytes
|
quint16 internal_fa; // internal file attributes 2 bytes
|
||||||
lcuint32 external_fa; // external file attributes 4 bytes
|
quint32 external_fa; // external file attributes 4 bytes
|
||||||
|
|
||||||
lcuint64 offset_curfile; // relative offset of local header 8 bytes
|
quint64 offset_curfile; // relative offset of local header 8 bytes
|
||||||
char file_name[256];
|
char file_name[256];
|
||||||
tm_unz tmu_date;
|
tm_unz tmu_date;
|
||||||
|
|
||||||
|
@ -56,27 +56,27 @@ public:
|
||||||
bool OpenRead(lcFile* File);
|
bool OpenRead(lcFile* File);
|
||||||
bool OpenWrite(const QString& FileName);
|
bool OpenWrite(const QString& FileName);
|
||||||
|
|
||||||
bool ExtractFile(int FileIndex, lcMemFile& File, lcuint32 MaxLength = 0xffffffff);
|
bool ExtractFile(int FileIndex, lcMemFile& File, quint32 MaxLength = 0xffffffff);
|
||||||
bool ExtractFile(const char* FileName, lcMemFile& File, lcuint32 MaxLength = 0xffffffff);
|
bool ExtractFile(const char* FileName, lcMemFile& File, quint32 MaxLength = 0xffffffff);
|
||||||
|
|
||||||
lcArray<lcZipFileInfo> mFiles;
|
lcArray<lcZipFileInfo> mFiles;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool Open();
|
bool Open();
|
||||||
bool ReadCentralDir();
|
bool ReadCentralDir();
|
||||||
lcuint64 SearchCentralDir();
|
quint64 SearchCentralDir();
|
||||||
lcuint64 SearchCentralDir64();
|
quint64 SearchCentralDir64();
|
||||||
bool CheckFileCoherencyHeader(int FileIndex, lcuint32* SizeVar, lcuint64* OffsetLocalExtraField, lcuint32* SizeLocalExtraField);
|
bool CheckFileCoherencyHeader(int FileIndex, quint32* SizeVar, quint64* OffsetLocalExtraField, quint32* SizeLocalExtraField);
|
||||||
|
|
||||||
QMutex mMutex;
|
QMutex mMutex;
|
||||||
lcFile* mFile;
|
lcFile* mFile;
|
||||||
|
|
||||||
bool mModified;
|
bool mModified;
|
||||||
bool mZip64;
|
bool mZip64;
|
||||||
lcuint64 mNumEntries;
|
quint64 mNumEntries;
|
||||||
lcuint64 mCentralDirSize;
|
quint64 mCentralDirSize;
|
||||||
lcuint64 mCentralDirOffset;
|
quint64 mCentralDirOffset;
|
||||||
lcuint64 mBytesBeforeZipFile;
|
quint64 mBytesBeforeZipFile;
|
||||||
lcuint64 mCentralPos;
|
quint64 mCentralPos;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -439,10 +439,10 @@ void lcLight::DrawPointLight(lcContext* Context) const
|
||||||
const int NumVertices = (Slices - 1) * Slices + 2;
|
const int NumVertices = (Slices - 1) * Slices + 2;
|
||||||
const float Radius = LC_LIGHT_SPHERE_RADIUS;
|
const float Radius = LC_LIGHT_SPHERE_RADIUS;
|
||||||
lcVector3 Vertices[NumVertices];
|
lcVector3 Vertices[NumVertices];
|
||||||
lcuint16 Indices[NumIndices];
|
quint16 Indices[NumIndices];
|
||||||
|
|
||||||
lcVector3* Vertex = Vertices;
|
lcVector3* Vertex = Vertices;
|
||||||
lcuint16* Index = Indices;
|
quint16* Index = Indices;
|
||||||
|
|
||||||
*Vertex++ = lcVector3(0, 0, Radius);
|
*Vertex++ = lcVector3(0, 0, Radius);
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ public:
|
||||||
return (mState & LC_LIGHT_SELECTION_MASK) != 0;
|
return (mState & LC_LIGHT_SELECTION_MASK) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool IsSelected(lcuint32 Section) const override
|
virtual bool IsSelected(quint32 Section) const override
|
||||||
{
|
{
|
||||||
switch (Section)
|
switch (Section)
|
||||||
{
|
{
|
||||||
|
@ -76,7 +76,7 @@ public:
|
||||||
mState &= ~(LC_LIGHT_SELECTION_MASK | LC_LIGHT_FOCUS_MASK);
|
mState &= ~(LC_LIGHT_SELECTION_MASK | LC_LIGHT_FOCUS_MASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void SetSelected(lcuint32 Section, bool Selected) override
|
virtual void SetSelected(quint32 Section, bool Selected) override
|
||||||
{
|
{
|
||||||
switch (Section)
|
switch (Section)
|
||||||
{
|
{
|
||||||
|
@ -104,7 +104,7 @@ public:
|
||||||
return (mState & LC_LIGHT_FOCUS_MASK) != 0;
|
return (mState & LC_LIGHT_FOCUS_MASK) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool IsFocused(lcuint32 Section) const override
|
virtual bool IsFocused(quint32 Section) const override
|
||||||
{
|
{
|
||||||
switch (Section)
|
switch (Section)
|
||||||
{
|
{
|
||||||
|
@ -119,7 +119,7 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void SetFocused(lcuint32 Section, bool Focused) override
|
virtual void SetFocused(quint32 Section, bool Focused) override
|
||||||
{
|
{
|
||||||
switch (Section)
|
switch (Section)
|
||||||
{
|
{
|
||||||
|
@ -142,7 +142,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual lcuint32 GetFocusSection() const override
|
virtual quint32 GetFocusSection() const override
|
||||||
{
|
{
|
||||||
if (mState & LC_LIGHT_POSITION_FOCUSED)
|
if (mState & LC_LIGHT_POSITION_FOCUSED)
|
||||||
return LC_LIGHT_SECTION_POSITION;
|
return LC_LIGHT_SECTION_POSITION;
|
||||||
|
@ -153,12 +153,12 @@ public:
|
||||||
return ~0;
|
return ~0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual lcuint32 GetAllowedTransforms() const override
|
virtual quint32 GetAllowedTransforms() const override
|
||||||
{
|
{
|
||||||
return LC_OBJECT_TRANSFORM_MOVE_X | LC_OBJECT_TRANSFORM_MOVE_Y | LC_OBJECT_TRANSFORM_MOVE_Z;
|
return LC_OBJECT_TRANSFORM_MOVE_X | LC_OBJECT_TRANSFORM_MOVE_Y | LC_OBJECT_TRANSFORM_MOVE_Z;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual lcVector3 GetSectionPosition(lcuint32 Section) const override
|
virtual lcVector3 GetSectionPosition(quint32 Section) const override
|
||||||
{
|
{
|
||||||
switch (Section)
|
switch (Section)
|
||||||
{
|
{
|
||||||
|
@ -220,7 +220,7 @@ protected:
|
||||||
void DrawPointLight(lcContext* Context) const;
|
void DrawPointLight(lcContext* Context) const;
|
||||||
void DrawSpotLight(lcContext* Context) const;
|
void DrawSpotLight(lcContext* Context) const;
|
||||||
|
|
||||||
lcuint32 mState;
|
quint32 mState;
|
||||||
char m_strName[81];
|
char m_strName[81];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "lc_math.h"
|
#include "lc_math.h"
|
||||||
#include "lc_array.h"
|
#include "lc_array.h"
|
||||||
|
|
||||||
typedef lcuint32 lcStep;
|
typedef quint32 lcStep;
|
||||||
#define LC_STEP_MAX 0xffffffff
|
#define LC_STEP_MAX 0xffffffff
|
||||||
|
|
||||||
enum lcObjectType
|
enum lcObjectType
|
||||||
|
@ -23,7 +23,7 @@ struct lcObjectKey
|
||||||
struct lcObjectSection
|
struct lcObjectSection
|
||||||
{
|
{
|
||||||
lcObject* Object;
|
lcObject* Object;
|
||||||
lcuint32 Section;
|
quint32 Section;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct lcObjectRayTest
|
struct lcObjectRayTest
|
||||||
|
@ -82,16 +82,16 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool IsSelected() const = 0;
|
virtual bool IsSelected() const = 0;
|
||||||
virtual bool IsSelected(lcuint32 Section) const = 0;
|
virtual bool IsSelected(quint32 Section) const = 0;
|
||||||
virtual void SetSelected(bool Selected) = 0;
|
virtual void SetSelected(bool Selected) = 0;
|
||||||
virtual void SetSelected(lcuint32 Section, bool Selected) = 0;
|
virtual void SetSelected(quint32 Section, bool Selected) = 0;
|
||||||
virtual bool IsFocused() const = 0;
|
virtual bool IsFocused() const = 0;
|
||||||
virtual bool IsFocused(lcuint32 Section) const = 0;
|
virtual bool IsFocused(quint32 Section) const = 0;
|
||||||
virtual void SetFocused(lcuint32 Section, bool Focused) = 0;
|
virtual void SetFocused(quint32 Section, bool Focused) = 0;
|
||||||
virtual lcuint32 GetFocusSection() const = 0;
|
virtual quint32 GetFocusSection() const = 0;
|
||||||
|
|
||||||
virtual lcuint32 GetAllowedTransforms() const = 0;
|
virtual quint32 GetAllowedTransforms() const = 0;
|
||||||
virtual lcVector3 GetSectionPosition(lcuint32 Section) const = 0;
|
virtual lcVector3 GetSectionPosition(quint32 Section) const = 0;
|
||||||
virtual void RayTest(lcObjectRayTest& ObjectRayTest) const = 0;
|
virtual void RayTest(lcObjectRayTest& ObjectRayTest) const = 0;
|
||||||
virtual void BoxTest(lcObjectBoxTest& ObjectBoxTest) const = 0;
|
virtual void BoxTest(lcObjectBoxTest& ObjectBoxTest) const = 0;
|
||||||
virtual void DrawInterface(lcContext* Context) const = 0;
|
virtual void DrawInterface(lcContext* Context) const = 0;
|
||||||
|
|
|
@ -174,7 +174,7 @@ bool lcPiece::ParseLDrawLine(QTextStream& Stream)
|
||||||
|
|
||||||
bool lcPiece::FileLoad(lcFile& file)
|
bool lcPiece::FileLoad(lcFile& file)
|
||||||
{
|
{
|
||||||
lcuint8 version, ch;
|
quint8 version, ch;
|
||||||
|
|
||||||
version = file.ReadU8();
|
version = file.ReadU8();
|
||||||
|
|
||||||
|
@ -186,10 +186,10 @@ bool lcPiece::FileLoad(lcFile& file)
|
||||||
if (file.ReadU8() != 1)
|
if (file.ReadU8() != 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
lcuint16 time;
|
quint16 time;
|
||||||
float param[4];
|
float param[4];
|
||||||
lcuint8 type;
|
quint8 type;
|
||||||
lcuint32 n;
|
quint32 n;
|
||||||
|
|
||||||
file.ReadU32(&n, 1);
|
file.ReadU32(&n, 1);
|
||||||
while (n--)
|
while (n--)
|
||||||
|
@ -215,12 +215,12 @@ bool lcPiece::FileLoad(lcFile& file)
|
||||||
|
|
||||||
if (version < 9)
|
if (version < 9)
|
||||||
{
|
{
|
||||||
lcuint16 time;
|
quint16 time;
|
||||||
lcuint8 type;
|
quint8 type;
|
||||||
|
|
||||||
if (version > 5)
|
if (version > 5)
|
||||||
{
|
{
|
||||||
lcuint32 keys;
|
quint32 keys;
|
||||||
float param[4];
|
float param[4];
|
||||||
|
|
||||||
file.ReadU32(&keys, 1);
|
file.ReadU32(&keys, 1);
|
||||||
|
@ -268,14 +268,14 @@ bool lcPiece::FileLoad(lcFile& file)
|
||||||
ModelWorld = lcMul(lcMatrix44RotationZ(Rotation[2] * LC_DTOR), lcMul(lcMatrix44RotationY(Rotation[1] * LC_DTOR), lcMul(lcMatrix44RotationX(Rotation[0] * LC_DTOR), ModelWorld)));
|
ModelWorld = lcMul(lcMatrix44RotationZ(Rotation[2] * LC_DTOR), lcMul(lcMatrix44RotationY(Rotation[1] * LC_DTOR), lcMul(lcMatrix44RotationX(Rotation[0] * LC_DTOR), ModelWorld)));
|
||||||
}
|
}
|
||||||
|
|
||||||
lcuint8 b;
|
quint8 b;
|
||||||
file.ReadU8(&b, 1);
|
file.ReadU8(&b, 1);
|
||||||
time = b;
|
time = b;
|
||||||
|
|
||||||
ChangeKey(mPositionKeys, ModelWorld.GetTranslation(), 1, true);
|
ChangeKey(mPositionKeys, ModelWorld.GetTranslation(), 1, true);
|
||||||
ChangeKey(mRotationKeys, lcMatrix33(ModelWorld), time, true);
|
ChangeKey(mRotationKeys, lcMatrix33(ModelWorld), time, true);
|
||||||
|
|
||||||
lcint32 bl;
|
qint32 bl;
|
||||||
file.ReadS32(&bl, 1);
|
file.ReadS32(&bl, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -311,7 +311,7 @@ bool lcPiece::FileLoad(lcFile& file)
|
||||||
// 11 (0.77)
|
// 11 (0.77)
|
||||||
if (version < 11)
|
if (version < 11)
|
||||||
{
|
{
|
||||||
lcuint8 Color;
|
quint8 Color;
|
||||||
|
|
||||||
file.ReadU8(&Color, 1);
|
file.ReadU8(&Color, 1);
|
||||||
|
|
||||||
|
@ -324,7 +324,7 @@ bool lcPiece::FileLoad(lcFile& file)
|
||||||
file.ReadU32(&mColorCode, 1);
|
file.ReadU32(&mColorCode, 1);
|
||||||
mColorIndex = lcGetColorIndex(mColorCode);
|
mColorIndex = lcGetColorIndex(mColorCode);
|
||||||
|
|
||||||
lcuint8 Step;
|
quint8 Step;
|
||||||
file.ReadU8(&Step, 1);
|
file.ReadU8(&Step, 1);
|
||||||
mStepShow = Step;
|
mStepShow = Step;
|
||||||
if (version > 1)
|
if (version > 1)
|
||||||
|
@ -342,7 +342,7 @@ bool lcPiece::FileLoad(lcFile& file)
|
||||||
|
|
||||||
if (version > 7)
|
if (version > 7)
|
||||||
{
|
{
|
||||||
lcuint8 Hidden;
|
quint8 Hidden;
|
||||||
file.ReadU8(&Hidden, 1);
|
file.ReadU8(&Hidden, 1);
|
||||||
if (Hidden & 1)
|
if (Hidden & 1)
|
||||||
mState |= LC_PIECE_HIDDEN;
|
mState |= LC_PIECE_HIDDEN;
|
||||||
|
@ -351,7 +351,7 @@ bool lcPiece::FileLoad(lcFile& file)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lcint32 hide;
|
qint32 hide;
|
||||||
file.ReadS32(&hide, 1);
|
file.ReadS32(&hide, 1);
|
||||||
if (hide != 0)
|
if (hide != 0)
|
||||||
mState |= LC_PIECE_HIDDEN;
|
mState |= LC_PIECE_HIDDEN;
|
||||||
|
@ -359,7 +359,7 @@ bool lcPiece::FileLoad(lcFile& file)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 7 (0.64)
|
// 7 (0.64)
|
||||||
lcint32 i = -1;
|
qint32 i = -1;
|
||||||
if (version > 6)
|
if (version > 6)
|
||||||
file.ReadS32(&i, 1);
|
file.ReadS32(&i, 1);
|
||||||
mGroup = (lcGroup*)(quintptr)i;
|
mGroup = (lcGroup*)(quintptr)i;
|
||||||
|
@ -677,7 +677,7 @@ void lcPiece::SubModelAddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMat
|
||||||
|
|
||||||
void lcPiece::Move(lcStep Step, bool AddKey, const lcVector3& Distance)
|
void lcPiece::Move(lcStep Step, bool AddKey, const lcVector3& Distance)
|
||||||
{
|
{
|
||||||
lcuint32 Section = GetFocusSection();
|
quint32 Section = GetFocusSection();
|
||||||
|
|
||||||
if (Section == LC_PIECE_SECTION_POSITION || Section == LC_PIECE_SECTION_INVALID)
|
if (Section == LC_PIECE_SECTION_POSITION || Section == LC_PIECE_SECTION_INVALID)
|
||||||
{
|
{
|
||||||
|
@ -705,7 +705,7 @@ void lcPiece::Move(lcStep Step, bool AddKey, const lcVector3& Distance)
|
||||||
|
|
||||||
void lcPiece::Rotate(lcStep Step, bool AddKey, const lcMatrix33& RotationMatrix, const lcVector3& Center, const lcMatrix33& RotationFrame)
|
void lcPiece::Rotate(lcStep Step, bool AddKey, const lcMatrix33& RotationMatrix, const lcVector3& Center, const lcMatrix33& RotationFrame)
|
||||||
{
|
{
|
||||||
lcuint32 Section = GetFocusSection();
|
quint32 Section = GetFocusSection();
|
||||||
|
|
||||||
if (Section == LC_PIECE_SECTION_POSITION || Section == LC_PIECE_SECTION_INVALID)
|
if (Section == LC_PIECE_SECTION_POSITION || Section == LC_PIECE_SECTION_INVALID)
|
||||||
{
|
{
|
||||||
|
@ -767,9 +767,9 @@ void lcPiece::RotatePivotPoint(const lcMatrix33& RotationMatrix)
|
||||||
mState |= LC_PIECE_PIVOT_POINT_VALID;
|
mState |= LC_PIECE_PIVOT_POINT_VALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
lcuint32 lcPiece::GetAllowedTransforms() const
|
quint32 lcPiece::GetAllowedTransforms() const
|
||||||
{
|
{
|
||||||
lcuint32 Section = GetFocusSection();
|
quint32 Section = GetFocusSection();
|
||||||
|
|
||||||
if (Section == LC_PIECE_SECTION_POSITION || Section == LC_PIECE_SECTION_INVALID)
|
if (Section == LC_PIECE_SECTION_POSITION || Section == LC_PIECE_SECTION_INVALID)
|
||||||
return LC_OBJECT_TRANSFORM_MOVE_X | LC_OBJECT_TRANSFORM_MOVE_Y | LC_OBJECT_TRANSFORM_MOVE_Z | LC_OBJECT_TRANSFORM_ROTATE_X | LC_OBJECT_TRANSFORM_ROTATE_Y | LC_OBJECT_TRANSFORM_ROTATE_Z;
|
return LC_OBJECT_TRANSFORM_MOVE_X | LC_OBJECT_TRANSFORM_MOVE_Y | LC_OBJECT_TRANSFORM_MOVE_Z | LC_OBJECT_TRANSFORM_ROTATE_X | LC_OBJECT_TRANSFORM_ROTATE_Y | LC_OBJECT_TRANSFORM_ROTATE_Z;
|
||||||
|
|
|
@ -63,7 +63,7 @@ public:
|
||||||
return (mState & LC_PIECE_SELECTION_MASK) != 0;
|
return (mState & LC_PIECE_SELECTION_MASK) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool IsSelected(lcuint32 Section) const override
|
virtual bool IsSelected(quint32 Section) const override
|
||||||
{
|
{
|
||||||
Q_UNUSED(Section);
|
Q_UNUSED(Section);
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ public:
|
||||||
mState &= ~(LC_PIECE_SELECTION_MASK | LC_PIECE_FOCUS_MASK);
|
mState &= ~(LC_PIECE_SELECTION_MASK | LC_PIECE_FOCUS_MASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void SetSelected(lcuint32 Section, bool Selected) override
|
virtual void SetSelected(quint32 Section, bool Selected) override
|
||||||
{
|
{
|
||||||
switch (Section)
|
switch (Section)
|
||||||
{
|
{
|
||||||
|
@ -152,7 +152,7 @@ public:
|
||||||
return (mState & LC_PIECE_FOCUS_MASK) != 0;
|
return (mState & LC_PIECE_FOCUS_MASK) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool IsFocused(lcuint32 Section) const override
|
virtual bool IsFocused(quint32 Section) const override
|
||||||
{
|
{
|
||||||
switch (Section)
|
switch (Section)
|
||||||
{
|
{
|
||||||
|
@ -187,7 +187,7 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void SetFocused(lcuint32 Section, bool Focused) override
|
virtual void SetFocused(quint32 Section, bool Focused) override
|
||||||
{
|
{
|
||||||
switch (Section)
|
switch (Section)
|
||||||
{
|
{
|
||||||
|
@ -256,7 +256,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual lcuint32 GetFocusSection() const override
|
virtual quint32 GetFocusSection() const override
|
||||||
{
|
{
|
||||||
if (mState & LC_PIECE_POSITION_FOCUSED)
|
if (mState & LC_PIECE_POSITION_FOCUSED)
|
||||||
return LC_PIECE_SECTION_POSITION;
|
return LC_PIECE_SECTION_POSITION;
|
||||||
|
@ -288,9 +288,9 @@ public:
|
||||||
return LC_PIECE_SECTION_INVALID;
|
return LC_PIECE_SECTION_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual lcuint32 GetAllowedTransforms() const override;
|
virtual quint32 GetAllowedTransforms() const override;
|
||||||
|
|
||||||
virtual lcVector3 GetSectionPosition(lcuint32 Section) const override
|
virtual lcVector3 GetSectionPosition(quint32 Section) const override
|
||||||
{
|
{
|
||||||
switch (Section)
|
switch (Section)
|
||||||
{
|
{
|
||||||
|
@ -456,7 +456,7 @@ public:
|
||||||
mStepHide = mStepShow + 1;
|
mStepHide = mStepShow + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetColorCode(lcuint32 ColorCode)
|
void SetColorCode(quint32 ColorCode)
|
||||||
{
|
{
|
||||||
mColorCode = ColorCode;
|
mColorCode = ColorCode;
|
||||||
mColorIndex = lcGetColorIndex(ColorCode);
|
mColorIndex = lcGetColorIndex(ColorCode);
|
||||||
|
@ -480,7 +480,7 @@ public:
|
||||||
|
|
||||||
lcVector3 GetRotationCenter() const
|
lcVector3 GetRotationCenter() const
|
||||||
{
|
{
|
||||||
lcuint32 Section = GetFocusSection();
|
quint32 Section = GetFocusSection();
|
||||||
|
|
||||||
if (Section == LC_PIECE_SECTION_POSITION || Section == LC_PIECE_SECTION_INVALID)
|
if (Section == LC_PIECE_SECTION_POSITION || Section == LC_PIECE_SECTION_INVALID)
|
||||||
{
|
{
|
||||||
|
@ -505,7 +505,7 @@ public:
|
||||||
|
|
||||||
lcMatrix33 GetRelativeRotation() const
|
lcMatrix33 GetRelativeRotation() const
|
||||||
{
|
{
|
||||||
lcuint32 Section = GetFocusSection();
|
quint32 Section = GetFocusSection();
|
||||||
|
|
||||||
if (Section == LC_PIECE_SECTION_POSITION || Section == LC_PIECE_SECTION_INVALID)
|
if (Section == LC_PIECE_SECTION_POSITION || Section == LC_PIECE_SECTION_INVALID)
|
||||||
{
|
{
|
||||||
|
@ -537,7 +537,7 @@ public:
|
||||||
PieceInfo* mPieceInfo;
|
PieceInfo* mPieceInfo;
|
||||||
|
|
||||||
int mColorIndex;
|
int mColorIndex;
|
||||||
lcuint32 mColorCode;
|
quint32 mColorCode;
|
||||||
|
|
||||||
lcMatrix44 mModelWorld;
|
lcMatrix44 mModelWorld;
|
||||||
lcMatrix44 mPivotMatrix;
|
lcMatrix44 mPivotMatrix;
|
||||||
|
@ -566,7 +566,7 @@ protected:
|
||||||
lcStep mStepShow;
|
lcStep mStepShow;
|
||||||
lcStep mStepHide;
|
lcStep mStepHide;
|
||||||
|
|
||||||
lcuint32 mState;
|
quint32 mState;
|
||||||
lcArray<lcPieceControlPoint> mControlPoints;
|
lcArray<lcPieceControlPoint> mControlPoints;
|
||||||
lcMesh* mMesh;
|
lcMesh* mMesh;
|
||||||
};
|
};
|
||||||
|
|
|
@ -153,7 +153,7 @@ public:
|
||||||
char m_strDescription[128];
|
char m_strDescription[128];
|
||||||
int mZipFileType;
|
int mZipFileType;
|
||||||
int mZipFileIndex;
|
int mZipFileIndex;
|
||||||
lcuint32 mFlags;
|
quint32 mFlags;
|
||||||
lcPieceInfoState mState;
|
lcPieceInfoState mState;
|
||||||
int mFolderType;
|
int mFolderType;
|
||||||
int mFolderIndex;
|
int mFolderIndex;
|
||||||
|
|
|
@ -657,7 +657,7 @@ void Project::Export3DStudio(const QString& FileName)
|
||||||
File.WriteU16(0x0030); // CHK_INT_PERCENTAGE
|
File.WriteU16(0x0030); // CHK_INT_PERCENTAGE
|
||||||
File.WriteU32(8);
|
File.WriteU32(8);
|
||||||
|
|
||||||
File.WriteS16((lcuint8)floor(100.0 * 0.25 + 0.5));
|
File.WriteS16((quint8)floor(100.0 * 0.25 + 0.5));
|
||||||
|
|
||||||
File.WriteU16(0xA041); // CHK_MAT_SHIN2PCT
|
File.WriteU16(0xA041); // CHK_MAT_SHIN2PCT
|
||||||
File.WriteU32(14);
|
File.WriteU32(14);
|
||||||
|
@ -665,7 +665,7 @@ void Project::Export3DStudio(const QString& FileName)
|
||||||
File.WriteU16(0x0030); // CHK_INT_PERCENTAGE
|
File.WriteU16(0x0030); // CHK_INT_PERCENTAGE
|
||||||
File.WriteU32(8);
|
File.WriteU32(8);
|
||||||
|
|
||||||
File.WriteS16((lcuint8)floor(100.0 * 0.05 + 0.5));
|
File.WriteS16((quint8)floor(100.0 * 0.05 + 0.5));
|
||||||
|
|
||||||
File.WriteU16(0xA050); // CHK_MAT_TRANSPARENCY
|
File.WriteU16(0xA050); // CHK_MAT_TRANSPARENCY
|
||||||
File.WriteU32(14);
|
File.WriteU32(14);
|
||||||
|
@ -673,7 +673,7 @@ void Project::Export3DStudio(const QString& FileName)
|
||||||
File.WriteU16(0x0030); // CHK_INT_PERCENTAGE
|
File.WriteU16(0x0030); // CHK_INT_PERCENTAGE
|
||||||
File.WriteU32(8);
|
File.WriteU32(8);
|
||||||
|
|
||||||
File.WriteS16((lcuint8)floor(100.0 * (1.0f - Color->Value[3]) + 0.5));
|
File.WriteS16((quint8)floor(100.0 * (1.0f - Color->Value[3]) + 0.5));
|
||||||
|
|
||||||
File.WriteU16(0xA052); // CHK_MAT_XPFALL
|
File.WriteU16(0xA052); // CHK_MAT_XPFALL
|
||||||
File.WriteU32(14);
|
File.WriteU32(14);
|
||||||
|
@ -681,7 +681,7 @@ void Project::Export3DStudio(const QString& FileName)
|
||||||
File.WriteU16(0x0030); // CHK_INT_PERCENTAGE
|
File.WriteU16(0x0030); // CHK_INT_PERCENTAGE
|
||||||
File.WriteU32(8);
|
File.WriteU32(8);
|
||||||
|
|
||||||
File.WriteS16((lcuint8)floor(100.0 * 0.0 + 0.5));
|
File.WriteS16((quint8)floor(100.0 * 0.0 + 0.5));
|
||||||
|
|
||||||
File.WriteU16(0xA053); // CHK_MAT_REFBLUR
|
File.WriteU16(0xA053); // CHK_MAT_REFBLUR
|
||||||
File.WriteU32(14);
|
File.WriteU32(14);
|
||||||
|
@ -689,7 +689,7 @@ void Project::Export3DStudio(const QString& FileName)
|
||||||
File.WriteU16(0x0030); // CHK_INT_PERCENTAGE
|
File.WriteU16(0x0030); // CHK_INT_PERCENTAGE
|
||||||
File.WriteU32(8);
|
File.WriteU32(8);
|
||||||
|
|
||||||
File.WriteS16((lcuint8)floor(100.0 * 0.2 + 0.5));
|
File.WriteS16((quint8)floor(100.0 * 0.2 + 0.5));
|
||||||
|
|
||||||
File.WriteU16(0xA100); // CHK_MAT_SHADING
|
File.WriteU16(0xA100); // CHK_MAT_SHADING
|
||||||
File.WriteU32(8);
|
File.WriteU32(8);
|
||||||
|
@ -702,7 +702,7 @@ void Project::Export3DStudio(const QString& FileName)
|
||||||
File.WriteU16(0x0030); // CHK_INT_PERCENTAGE
|
File.WriteU16(0x0030); // CHK_INT_PERCENTAGE
|
||||||
File.WriteU32(8);
|
File.WriteU32(8);
|
||||||
|
|
||||||
File.WriteS16((lcuint8)floor(100.0 * 0.0 + 0.5));
|
File.WriteS16((quint8)floor(100.0 * 0.0 + 0.5));
|
||||||
|
|
||||||
File.WriteU16(0xA081); // CHK_MAT_TWO_SIDE
|
File.WriteU16(0xA081); // CHK_MAT_TWO_SIDE
|
||||||
File.WriteU32(6);
|
File.WriteU32(6);
|
||||||
|
@ -780,7 +780,7 @@ void Project::Export3DStudio(const QString& FileName)
|
||||||
|
|
||||||
File.WriteU16(0x1100); // CHK_BIT_MAP
|
File.WriteU16(0x1100); // CHK_BIT_MAP
|
||||||
QByteArray BackgroundImage = Properties.mBackgroundImage.toLatin1();
|
QByteArray BackgroundImage = Properties.mBackgroundImage.toLatin1();
|
||||||
File.WriteU32(6 + 1 + (lcuint32)strlen(BackgroundImage.constData()));
|
File.WriteU32(6 + 1 + (quint32)strlen(BackgroundImage.constData()));
|
||||||
File.WriteBuffer(BackgroundImage.constData(), strlen(BackgroundImage.constData()) + 1);
|
File.WriteBuffer(BackgroundImage.constData(), strlen(BackgroundImage.constData()) + 1);
|
||||||
|
|
||||||
File.WriteU16(0x1300); // CHK_V_GRADIENT
|
File.WriteU16(0x1300); // CHK_V_GRADIENT
|
||||||
|
@ -911,7 +911,7 @@ void Project::Export3DStudio(const QString& FileName)
|
||||||
if (Section->PrimitiveType != LC_MESH_TRIANGLES && Section->PrimitiveType != LC_MESH_TEXTURED_TRIANGLES)
|
if (Section->PrimitiveType != LC_MESH_TRIANGLES && Section->PrimitiveType != LC_MESH_TEXTURED_TRIANGLES)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
lcuint16* Indices = (lcuint16*)Mesh->mIndexData + Section->IndexOffset / sizeof(lcuint16);
|
quint16* Indices = (quint16*)Mesh->mIndexData + Section->IndexOffset / sizeof(quint16);
|
||||||
|
|
||||||
for (int IndexIdx = 0; IndexIdx < Section->NumIndices; IndexIdx += 3)
|
for (int IndexIdx = 0; IndexIdx < Section->NumIndices; IndexIdx += 3)
|
||||||
{
|
{
|
||||||
|
@ -2212,7 +2212,7 @@ void Project::ExportWavefront(const QString& FileName)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
lcuint32 vert = 1;
|
quint32 vert = 1;
|
||||||
|
|
||||||
OBJFile.WriteLine("# Model exported from LeoCAD\n");
|
OBJFile.WriteLine("# Model exported from LeoCAD\n");
|
||||||
|
|
||||||
|
|
|
@ -715,22 +715,22 @@ void View::OnDraw()
|
||||||
|
|
||||||
if (!mRenderImage.isNull())
|
if (!mRenderImage.isNull())
|
||||||
{
|
{
|
||||||
lcuint8* Buffer = (lcuint8*)malloc(mWidth * mHeight * 4);
|
quint8* Buffer = (quint8*)malloc(mWidth * mHeight * 4);
|
||||||
uchar* ImageBuffer = mRenderImage.bits();
|
uchar* ImageBuffer = mRenderImage.bits();
|
||||||
|
|
||||||
glFinish();
|
glFinish();
|
||||||
glReadPixels(0, 0, CurrentTileWidth, CurrentTileHeight, GL_RGBA, GL_UNSIGNED_BYTE, Buffer);
|
glReadPixels(0, 0, CurrentTileWidth, CurrentTileHeight, GL_RGBA, GL_UNSIGNED_BYTE, Buffer);
|
||||||
|
|
||||||
lcuint32 TileY = 0;
|
quint32 TileY = 0;
|
||||||
if (CurrentTileRow != TotalTileRows - 1)
|
if (CurrentTileRow != TotalTileRows - 1)
|
||||||
TileY = (TotalTileRows - CurrentTileRow - 1) * mHeight - (mHeight - mRenderImage.height() % mHeight);
|
TileY = (TotalTileRows - CurrentTileRow - 1) * mHeight - (mHeight - mRenderImage.height() % mHeight);
|
||||||
|
|
||||||
lcuint32 TileStart = ((CurrentTileColumn * mWidth) + (TileY * mRenderImage.width())) * 4;
|
quint32 TileStart = ((CurrentTileColumn * mWidth) + (TileY * mRenderImage.width())) * 4;
|
||||||
|
|
||||||
for (int y = 0; y < CurrentTileHeight; y++)
|
for (int y = 0; y < CurrentTileHeight; y++)
|
||||||
{
|
{
|
||||||
lcuint8* src = Buffer + (CurrentTileHeight - y - 1) * CurrentTileWidth * 4;
|
quint8* src = Buffer + (CurrentTileHeight - y - 1) * CurrentTileWidth * 4;
|
||||||
lcuint8* dst = ImageBuffer + TileStart + y * mRenderImage.width() * 4;
|
quint8* dst = ImageBuffer + TileStart + y * mRenderImage.width() * 4;
|
||||||
|
|
||||||
for (int x = 0; x < CurrentTileWidth; x++)
|
for (int x = 0; x < CurrentTileWidth; x++)
|
||||||
{
|
{
|
||||||
|
@ -803,7 +803,7 @@ void View::DrawSelectMoveOverlay()
|
||||||
mContext->SetVertexFormatPosition(3);
|
mContext->SetVertexFormatPosition(3);
|
||||||
|
|
||||||
lcObject* Focus = mModel->GetFocusObject();
|
lcObject* Focus = mModel->GetFocusObject();
|
||||||
lcuint32 AllowedTransforms = Focus ? Focus->GetAllowedTransforms() : LC_OBJECT_TRANSFORM_MOVE_X | LC_OBJECT_TRANSFORM_MOVE_Y | LC_OBJECT_TRANSFORM_MOVE_Z | LC_OBJECT_TRANSFORM_ROTATE_X | LC_OBJECT_TRANSFORM_ROTATE_Y | LC_OBJECT_TRANSFORM_ROTATE_Z;
|
quint32 AllowedTransforms = Focus ? Focus->GetAllowedTransforms() : LC_OBJECT_TRANSFORM_MOVE_X | LC_OBJECT_TRANSFORM_MOVE_Y | LC_OBJECT_TRANSFORM_MOVE_Z | LC_OBJECT_TRANSFORM_ROTATE_X | LC_OBJECT_TRANSFORM_ROTATE_Y | LC_OBJECT_TRANSFORM_ROTATE_Z;
|
||||||
|
|
||||||
if (mTrackButton == LC_TRACKBUTTON_NONE || (mTrackTool >= LC_TRACKTOOL_MOVE_X && mTrackTool <= LC_TRACKTOOL_MOVE_XYZ))
|
if (mTrackButton == LC_TRACKBUTTON_NONE || (mTrackTool >= LC_TRACKTOOL_MOVE_X && mTrackTool <= LC_TRACKTOOL_MOVE_XYZ))
|
||||||
{
|
{
|
||||||
|
@ -902,7 +902,7 @@ void View::DrawSelectMoveOverlay()
|
||||||
if (Focus && Focus->IsPiece())
|
if (Focus && Focus->IsPiece())
|
||||||
{
|
{
|
||||||
lcPiece* Piece = (lcPiece*)Focus;
|
lcPiece* Piece = (lcPiece*)Focus;
|
||||||
lcuint32 Section = Piece->GetFocusSection();
|
quint32 Section = Piece->GetFocusSection();
|
||||||
|
|
||||||
if (Section >= LC_PIECE_SECTION_CONTROL_POINT_1 && Section <= LC_PIECE_SECTION_CONTROL_POINT_8 && Piece->mPieceInfo->GetSynthInfo() && Piece->mPieceInfo->GetSynthInfo()->IsCurve())
|
if (Section >= LC_PIECE_SECTION_CONTROL_POINT_1 && Section <= LC_PIECE_SECTION_CONTROL_POINT_8 && Piece->mPieceInfo->GetSynthInfo() && Piece->mPieceInfo->GetSynthInfo()->IsCurve())
|
||||||
{
|
{
|
||||||
|
@ -1884,13 +1884,13 @@ void View::UpdateTrackTool()
|
||||||
if (Focus && Focus->IsPiece())
|
if (Focus && Focus->IsPiece())
|
||||||
{
|
{
|
||||||
lcPiece* Piece = (lcPiece*)Focus;
|
lcPiece* Piece = (lcPiece*)Focus;
|
||||||
lcuint32 Section = Piece->GetFocusSection();
|
quint32 Section = Piece->GetFocusSection();
|
||||||
|
|
||||||
if (Section >= LC_PIECE_SECTION_CONTROL_POINT_1 && Section <= LC_PIECE_SECTION_CONTROL_POINT_8)
|
if (Section >= LC_PIECE_SECTION_CONTROL_POINT_1 && Section <= LC_PIECE_SECTION_CONTROL_POINT_8)
|
||||||
ControlPointIndex = Section - LC_PIECE_SECTION_CONTROL_POINT_1;
|
ControlPointIndex = Section - LC_PIECE_SECTION_CONTROL_POINT_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
lcuint32 AllowedTransforms = Focus ? Focus->GetAllowedTransforms() : LC_OBJECT_TRANSFORM_MOVE_X | LC_OBJECT_TRANSFORM_MOVE_Y | LC_OBJECT_TRANSFORM_MOVE_Z | LC_OBJECT_TRANSFORM_ROTATE_X | LC_OBJECT_TRANSFORM_ROTATE_Y | LC_OBJECT_TRANSFORM_ROTATE_Z;
|
quint32 AllowedTransforms = Focus ? Focus->GetAllowedTransforms() : LC_OBJECT_TRANSFORM_MOVE_X | LC_OBJECT_TRANSFORM_MOVE_Y | LC_OBJECT_TRANSFORM_MOVE_Z | LC_OBJECT_TRANSFORM_ROTATE_X | LC_OBJECT_TRANSFORM_ROTATE_Y | LC_OBJECT_TRANSFORM_ROTATE_Z;
|
||||||
|
|
||||||
for (int AxisIndex = 0; AxisIndex < 3; AxisIndex++)
|
for (int AxisIndex = 0; AxisIndex < 3; AxisIndex++)
|
||||||
{
|
{
|
||||||
|
@ -2250,7 +2250,7 @@ void View::UpdateTrackTool()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool View::IsTrackToolAllowed(lcTrackTool TrackTool, lcuint32 AllowedTransforms) const
|
bool View::IsTrackToolAllowed(lcTrackTool TrackTool, quint32 AllowedTransforms) const
|
||||||
{
|
{
|
||||||
switch (TrackTool)
|
switch (TrackTool)
|
||||||
{
|
{
|
||||||
|
@ -2825,7 +2825,7 @@ void View::OnMouseMove()
|
||||||
if (Focus && Focus->IsPiece())
|
if (Focus && Focus->IsPiece())
|
||||||
{
|
{
|
||||||
lcPiece* Piece = (lcPiece*)Focus;
|
lcPiece* Piece = (lcPiece*)Focus;
|
||||||
lcuint32 Section = Piece->GetFocusSection();
|
quint32 Section = Piece->GetFocusSection();
|
||||||
|
|
||||||
if (Section >= LC_PIECE_SECTION_CONTROL_POINT_1 && Section <= LC_PIECE_SECTION_CONTROL_POINT_8)
|
if (Section >= LC_PIECE_SECTION_CONTROL_POINT_1 && Section <= LC_PIECE_SECTION_CONTROL_POINT_8)
|
||||||
{
|
{
|
||||||
|
|
|
@ -146,7 +146,7 @@ protected:
|
||||||
void DrawViewport();
|
void DrawViewport();
|
||||||
|
|
||||||
void UpdateTrackTool();
|
void UpdateTrackTool();
|
||||||
bool IsTrackToolAllowed(lcTrackTool TrackTool, lcuint32 AllowedTransforms) const;
|
bool IsTrackToolAllowed(lcTrackTool TrackTool, quint32 AllowedTransforms) const;
|
||||||
lcTool GetCurrentTool() const;
|
lcTool GetCurrentTool() const;
|
||||||
lcTrackTool GetOverrideTrackTool(Qt::MouseButton Button) const;
|
lcTrackTool GetOverrideTrackTool(Qt::MouseButton Button) const;
|
||||||
float GetOverlayScale() const;
|
float GetOverlayScale() const;
|
||||||
|
|
|
@ -171,7 +171,7 @@ void lcQPreferencesDialog::colorClicked()
|
||||||
{
|
{
|
||||||
QObject *button = sender();
|
QObject *button = sender();
|
||||||
QString title;
|
QString title;
|
||||||
lcuint32 *color = nullptr;
|
quint32 *color = nullptr;
|
||||||
QColorDialog::ColorDialogOptions dialogOptions;
|
QColorDialog::ColorDialogOptions dialogOptions;
|
||||||
|
|
||||||
if (button == ui->gridStudColor)
|
if (button == ui->gridStudColor)
|
||||||
|
|
|
@ -435,7 +435,7 @@ QWidget *lcQPropertiesTree::createEditor(QWidget *parent, QTreeWidgetItem *item)
|
||||||
case PropertyInt:
|
case PropertyInt:
|
||||||
{
|
{
|
||||||
QLineEdit *editor = new QLineEdit(parent);
|
QLineEdit *editor = new QLineEdit(parent);
|
||||||
lcuint32 value = item->data(0, PropertyValueRole).toUInt();
|
quint32 value = item->data(0, PropertyValueRole).toUInt();
|
||||||
|
|
||||||
editor->setValidator(new QIntValidator());
|
editor->setValidator(new QIntValidator());
|
||||||
editor->setText(QString::number(value));
|
editor->setText(QString::number(value));
|
||||||
|
|
|
@ -167,11 +167,11 @@ void lcRenderDialog::Update()
|
||||||
|
|
||||||
struct lcSharedMemoryHeader
|
struct lcSharedMemoryHeader
|
||||||
{
|
{
|
||||||
uint32_t Version;
|
quint32 Version;
|
||||||
uint32_t Width;
|
quint32 Width;
|
||||||
uint32_t Height;
|
quint32 Height;
|
||||||
uint32_t PixelsWritten;
|
quint32 PixelsWritten;
|
||||||
uint32_t PixelsRead;
|
quint32 PixelsRead;
|
||||||
};
|
};
|
||||||
|
|
||||||
lcSharedMemoryHeader* Header = (lcSharedMemoryHeader*)Buffer;
|
lcSharedMemoryHeader* Header = (lcSharedMemoryHeader*)Buffer;
|
||||||
|
@ -183,7 +183,7 @@ void lcRenderDialog::Update()
|
||||||
// if (width != expected) ...
|
// if (width != expected) ...
|
||||||
|
|
||||||
QImage Image(Width, Height, QImage::Format_ARGB32);
|
QImage Image(Width, Height, QImage::Format_ARGB32);
|
||||||
uint8_t* Pixels = (uint8_t*)(Header + 1);
|
quint8* Pixels = (quint8*)(Header + 1);
|
||||||
|
|
||||||
for (int y = 0; y < Height; y++)
|
for (int y = 0; y < Height; y++)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue