mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- Backend update from Raze, mostly maintenance changes without new functionality.
This commit is contained in:
parent
283c5d688c
commit
c89ae6358e
22 changed files with 90 additions and 43 deletions
|
@ -796,19 +796,19 @@ void F2DDrawer::AddPoly(FGameTexture *texture, FVector2 *points, int npoints,
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void F2DDrawer::AddPoly(FGameTexture* img, FVector4* vt, size_t vtcount, const unsigned int* ind, size_t idxcount, int translation, PalEntry color, FRenderStyle style, int clipx1, int clipy1, int clipx2, int clipy2)
|
void F2DDrawer::AddPoly(FGameTexture* img, FVector4* vt, size_t vtcount, const unsigned int* ind, size_t idxcount, int translation, PalEntry color, FRenderStyle style, const IntRect* clip)
|
||||||
{
|
{
|
||||||
RenderCommand dg;
|
RenderCommand dg;
|
||||||
|
|
||||||
if (!img || !img->isValid()) return;
|
if (!img || !img->isValid()) return;
|
||||||
|
|
||||||
dg.mType = DrawTypeTriangles;
|
dg.mType = DrawTypeTriangles;
|
||||||
if (clipx1 > 0 || clipy1 > 0 || clipx2 < GetWidth() - 1 || clipy2 < GetHeight() - 1)
|
if (clip != nullptr)
|
||||||
{
|
{
|
||||||
dg.mScissor[0] = clipx1 + int(offset.X);
|
dg.mScissor[0] = clip->Left() + int(offset.X);
|
||||||
dg.mScissor[1] = clipy1 + int(offset.Y);
|
dg.mScissor[1] = clip->Top() + int(offset.Y);
|
||||||
dg.mScissor[2] = clipx2 + 1 + int(offset.X);
|
dg.mScissor[2] = clip->Right() + int(offset.X);
|
||||||
dg.mScissor[3] = clipy2 + 1 + int(offset.Y);
|
dg.mScissor[3] = clip->Bottom() + int(offset.Y);
|
||||||
dg.mFlags |= DTF_Scissor;
|
dg.mFlags |= DTF_Scissor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -216,7 +216,7 @@ public:
|
||||||
void AddPoly(FGameTexture *texture, FVector2 *points, int npoints,
|
void AddPoly(FGameTexture *texture, FVector2 *points, int npoints,
|
||||||
double originx, double originy, double scalex, double scaley,
|
double originx, double originy, double scalex, double scaley,
|
||||||
DAngle rotation, const FColormap &colormap, PalEntry flatcolor, double lightlevel, uint32_t *indices, size_t indexcount);
|
DAngle rotation, const FColormap &colormap, PalEntry flatcolor, double lightlevel, uint32_t *indices, size_t indexcount);
|
||||||
void AddPoly(FGameTexture* img, FVector4 *vt, size_t vtcount, const unsigned int *ind, size_t idxcount, int translation, PalEntry color, FRenderStyle style, int clipx1, int clipy1, int clipx2, int clipy2);
|
void AddPoly(FGameTexture* img, FVector4 *vt, size_t vtcount, const unsigned int *ind, size_t idxcount, int translation, PalEntry color, FRenderStyle style, const IntRect* clip);
|
||||||
void FillPolygon(int* rx1, int* ry1, int* xb1, int32_t npoints, int picnum, int palette, int shade, int props, const FVector2& xtex, const FVector2& ytex, const FVector2& otex,
|
void FillPolygon(int* rx1, int* ry1, int* xb1, int32_t npoints, int picnum, int palette, int shade, int props, const FVector2& xtex, const FVector2& ytex, const FVector2& otex,
|
||||||
int clipx1, int clipy1, int clipx2, int clipy2);
|
int clipx1, int clipy1, int clipx2, int clipy2);
|
||||||
void AddFlatFill(int left, int top, int right, int bottom, FGameTexture *src, int local_origin = false, double flatscale = 1.0, PalEntry color = 0xffffffff, ERenderStyle rs = STYLE_Normal);
|
void AddFlatFill(int left, int top, int right, int bottom, FGameTexture *src, int local_origin = false, double flatscale = 1.0, PalEntry color = 0xffffffff, ERenderStyle rs = STYLE_Normal);
|
||||||
|
|
|
@ -57,17 +57,19 @@
|
||||||
// \c becomes just TEXTCOLOR_ESCAPE
|
// \c becomes just TEXTCOLOR_ESCAPE
|
||||||
// $<cvar> is replaced by the contents of <cvar>
|
// $<cvar> is replaced by the contents of <cvar>
|
||||||
|
|
||||||
static long ParseCommandLine(const char* args, int* argc, char** argv, bool no_escapes)
|
static size_t ParseCommandLine(const char* args, int* argc, char** argv, bool no_escapes)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
|
char* buffstart;
|
||||||
char* buffplace;
|
char* buffplace;
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
buffplace = NULL;
|
buffstart = NULL;
|
||||||
if (argv != NULL)
|
if (argv != NULL)
|
||||||
{
|
{
|
||||||
buffplace = argv[0];
|
buffstart = argv[0];
|
||||||
}
|
}
|
||||||
|
buffplace = buffstart;
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
@ -154,7 +156,7 @@ static long ParseCommandLine(const char* args, int* argc, char** argv, bool no_e
|
||||||
{
|
{
|
||||||
*argc = count;
|
*argc = count;
|
||||||
}
|
}
|
||||||
return (long)(buffplace - (char*)0);
|
return (buffplace - buffstart);
|
||||||
}
|
}
|
||||||
|
|
||||||
FCommandLine::FCommandLine (const char *commandline, bool no_escapes)
|
FCommandLine::FCommandLine (const char *commandline, bool no_escapes)
|
||||||
|
|
|
@ -50,9 +50,9 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const char *cmd;
|
const char *cmd;
|
||||||
|
bool noescapes;
|
||||||
int _argc;
|
int _argc;
|
||||||
char **_argv;
|
char **_argv;
|
||||||
long argsize;
|
size_t argsize;
|
||||||
bool noescapes;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -155,12 +155,13 @@ unsigned FindModel(const char * path, const char * modelfile)
|
||||||
FModel * model = nullptr;
|
FModel * model = nullptr;
|
||||||
FString fullname;
|
FString fullname;
|
||||||
|
|
||||||
fullname.Format("%s%s", path, modelfile);
|
if (path) fullname.Format("%s%s", path, modelfile);
|
||||||
|
else fullname = modelfile;
|
||||||
int lump = fileSystem.CheckNumForFullName(fullname);
|
int lump = fileSystem.CheckNumForFullName(fullname);
|
||||||
|
|
||||||
if (lump<0)
|
if (lump<0)
|
||||||
{
|
{
|
||||||
Printf("FindModel: '%s' not found\n", fullname.GetChars());
|
Printf(PRINT_HIGH, "FindModel: '%s' not found\n", fullname.GetChars());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,7 +227,7 @@ unsigned FindModel(const char * path, const char * modelfile)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Printf("LoadModel: Unknown model format in '%s'\n", fullname.GetChars());
|
Printf(PRINT_HIGH, "LoadModel: Unknown model format in '%s'\n", fullname.GetChars());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,13 @@ enum ModelRendererType
|
||||||
NumModelRendererTypes
|
NumModelRendererTypes
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum EFrameError
|
||||||
|
{
|
||||||
|
FErr_NotFound = -1,
|
||||||
|
FErr_Voxel = -2,
|
||||||
|
FErr_Singleframe = -3
|
||||||
|
};
|
||||||
|
|
||||||
class FModel
|
class FModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -60,7 +67,7 @@ public:
|
||||||
virtual ~FModel();
|
virtual ~FModel();
|
||||||
|
|
||||||
virtual bool Load(const char * fn, int lumpnum, const char * buffer, int length) = 0;
|
virtual bool Load(const char * fn, int lumpnum, const char * buffer, int length) = 0;
|
||||||
virtual int FindFrame(const char * name) = 0;
|
virtual int FindFrame(const char * name, bool nodefault = false) = 0;
|
||||||
virtual void RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, int translation, const FTextureID* surfaceskinids) = 0;
|
virtual void RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, int translation, const FTextureID* surfaceskinids) = 0;
|
||||||
virtual void BuildVertexBuffer(FModelRenderer *renderer) = 0;
|
virtual void BuildVertexBuffer(FModelRenderer *renderer) = 0;
|
||||||
virtual void AddSkins(uint8_t *hitlist, const FTextureID* surfaceskinids) = 0;
|
virtual void AddSkins(uint8_t *hitlist, const FTextureID* surfaceskinids) = 0;
|
||||||
|
|
|
@ -15,9 +15,9 @@ struct FVoxelVertexHash
|
||||||
// Returns the hash value for a key.
|
// Returns the hash value for a key.
|
||||||
hash_t Hash(const FModelVertex &key)
|
hash_t Hash(const FModelVertex &key)
|
||||||
{
|
{
|
||||||
int ix = xs_RoundToInt(key.x);
|
int ix = int(key.x);
|
||||||
int iy = xs_RoundToInt(key.y);
|
int iy = int(key.y);
|
||||||
int iz = xs_RoundToInt(key.z);
|
int iz = int(key.z);
|
||||||
return (hash_t)(ix + (iy<<9) + (iz<<18));
|
return (hash_t)(ix + (iy<<9) + (iz<<18));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ public:
|
||||||
~FVoxelModel();
|
~FVoxelModel();
|
||||||
bool Load(const char * fn, int lumpnum, const char * buffer, int length) override;
|
bool Load(const char * fn, int lumpnum, const char * buffer, int length) override;
|
||||||
void Initialize();
|
void Initialize();
|
||||||
virtual int FindFrame(const char * name) override;
|
virtual int FindFrame(const char * name, bool nodefault) override;
|
||||||
virtual void RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, int translation, const FTextureID* surfaceskinids) override;
|
virtual void RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, int translation, const FTextureID* surfaceskinids) override;
|
||||||
virtual void AddSkins(uint8_t *hitlist, const FTextureID* surfaceskinids) override;
|
virtual void AddSkins(uint8_t *hitlist, const FTextureID* surfaceskinids) override;
|
||||||
FTextureID GetPaletteTexture() const { return mPalette; }
|
FTextureID GetPaletteTexture() const { return mPalette; }
|
||||||
|
|
|
@ -112,7 +112,7 @@ public:
|
||||||
virtual ~FDMDModel();
|
virtual ~FDMDModel();
|
||||||
|
|
||||||
virtual bool Load(const char * fn, int lumpnum, const char * buffer, int length) override;
|
virtual bool Load(const char * fn, int lumpnum, const char * buffer, int length) override;
|
||||||
virtual int FindFrame(const char * name) override;
|
virtual int FindFrame(const char * name, bool nodefault) override;
|
||||||
virtual void RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, int translation, const FTextureID* surfaceskinids) override;
|
virtual void RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, int translation, const FTextureID* surfaceskinids) override;
|
||||||
virtual void LoadGeometry();
|
virtual void LoadGeometry();
|
||||||
virtual void AddSkins(uint8_t *hitlist, const FTextureID* surfaceskinids) override;
|
virtual void AddSkins(uint8_t *hitlist, const FTextureID* surfaceskinids) override;
|
||||||
|
|
|
@ -66,7 +66,7 @@ public:
|
||||||
FMD3Model() = default;
|
FMD3Model() = default;
|
||||||
|
|
||||||
virtual bool Load(const char * fn, int lumpnum, const char * buffer, int length) override;
|
virtual bool Load(const char * fn, int lumpnum, const char * buffer, int length) override;
|
||||||
virtual int FindFrame(const char * name) override;
|
virtual int FindFrame(const char * name, bool nodefault) override;
|
||||||
virtual void RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, int translation, const FTextureID* surfaceskinids) override;
|
virtual void RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, int translation, const FTextureID* surfaceskinids) override;
|
||||||
void LoadGeometry();
|
void LoadGeometry();
|
||||||
void BuildVertexBuffer(FModelRenderer *renderer);
|
void BuildVertexBuffer(FModelRenderer *renderer);
|
||||||
|
|
|
@ -97,7 +97,7 @@ public:
|
||||||
FOBJModel(): hasMissingNormals(false), hasSmoothGroups(false), vertFaces(nullptr) {}
|
FOBJModel(): hasMissingNormals(false), hasSmoothGroups(false), vertFaces(nullptr) {}
|
||||||
~FOBJModel();
|
~FOBJModel();
|
||||||
bool Load(const char* fn, int lumpnum, const char* buffer, int length) override;
|
bool Load(const char* fn, int lumpnum, const char* buffer, int length) override;
|
||||||
int FindFrame(const char* name) override;
|
int FindFrame(const char* name, bool nodefault) override;
|
||||||
void RenderFrame(FModelRenderer* renderer, FGameTexture* skin, int frame, int frame2, double inter, int translation, const FTextureID* surfaceskinids) override;
|
void RenderFrame(FModelRenderer* renderer, FGameTexture* skin, int frame, int frame2, double inter, int translation, const FTextureID* surfaceskinids) override;
|
||||||
void BuildVertexBuffer(FModelRenderer* renderer) override;
|
void BuildVertexBuffer(FModelRenderer* renderer) override;
|
||||||
void AddSkins(uint8_t* hitlist, const FTextureID* surfaceskinids) override;
|
void AddSkins(uint8_t* hitlist, const FTextureID* surfaceskinids) override;
|
||||||
|
|
|
@ -25,7 +25,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
bool Load(const char * fn, int lumpnum, const char * buffer, int length) override;
|
bool Load(const char * fn, int lumpnum, const char * buffer, int length) override;
|
||||||
int FindFrame(const char * name) override;
|
int FindFrame(const char * name, bool nodefault) override;
|
||||||
void RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, int translation, const FTextureID* surfaceskinids) override;
|
void RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, int translation, const FTextureID* surfaceskinids) override;
|
||||||
void BuildVertexBuffer(FModelRenderer *renderer) override;
|
void BuildVertexBuffer(FModelRenderer *renderer) override;
|
||||||
void AddSkins(uint8_t *hitlist, const FTextureID* surfaceskinids) override;
|
void AddSkins(uint8_t *hitlist, const FTextureID* surfaceskinids) override;
|
||||||
|
|
|
@ -348,13 +348,13 @@ void FDMDModel::AddSkins(uint8_t *hitlist, const FTextureID*)
|
||||||
// FDMDModel::FindFrame
|
// FDMDModel::FindFrame
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
int FDMDModel::FindFrame(const char * name)
|
int FDMDModel::FindFrame(const char * name, bool nodefault)
|
||||||
{
|
{
|
||||||
for (int i=0;i<info.numFrames;i++)
|
for (int i=0;i<info.numFrames;i++)
|
||||||
{
|
{
|
||||||
if (!stricmp(name, frames[i].name)) return i;
|
if (!stricmp(name, frames[i].name)) return i;
|
||||||
}
|
}
|
||||||
return -1;
|
return FErr_NotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
|
@ -328,13 +328,13 @@ void FMD3Model::AddSkins(uint8_t *hitlist, const FTextureID* surfaceskinids)
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
int FMD3Model::FindFrame(const char * name)
|
int FMD3Model::FindFrame(const char * name, bool nodefault)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < Frames.Size(); i++)
|
for (unsigned i = 0; i < Frames.Size(); i++)
|
||||||
{
|
{
|
||||||
if (!stricmp(name, Frames[i].Name)) return i;
|
if (!stricmp(name, Frames[i].Name)) return i;
|
||||||
}
|
}
|
||||||
return -1;
|
return FErr_NotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
|
@ -613,9 +613,9 @@ FVector3 FOBJModel::CalculateNormalSmooth(unsigned int vidx, unsigned int smooth
|
||||||
* @param name The name of the frame
|
* @param name The name of the frame
|
||||||
* @return The index of the frame
|
* @return The index of the frame
|
||||||
*/
|
*/
|
||||||
int FOBJModel::FindFrame(const char* name)
|
int FOBJModel::FindFrame(const char* name, bool nodefault)
|
||||||
{
|
{
|
||||||
return 0; // OBJs are not animated.
|
return nodefault? FErr_Singleframe : 0; // OBJs are not animated.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -221,10 +221,12 @@ void FUE1Model::UnloadGeometry()
|
||||||
groups.Reset();
|
groups.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
int FUE1Model::FindFrame( const char *name )
|
int FUE1Model::FindFrame( const char *name, bool nodefault )
|
||||||
{
|
{
|
||||||
// unsupported, there are no named frames
|
// there are no named frames, but we need something here to properly interface with it. So just treat the string as an index number.
|
||||||
return -1;
|
auto index = strtol(name, nullptr, 0);
|
||||||
|
if (index < 0 || index >= numFrames) return FErr_NotFound;
|
||||||
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FUE1Model::RenderFrame( FModelRenderer *renderer, FGameTexture *skin, int frame, int frame2, double inter, int translation, const FTextureID* surfaceskinids)
|
void FUE1Model::RenderFrame( FModelRenderer *renderer, FGameTexture *skin, int frame, int frame2, double inter, int translation, const FTextureID* surfaceskinids)
|
||||||
|
|
|
@ -378,9 +378,9 @@ bool FVoxelModel::Load(const char * fn, int lumpnum, const char * buffer, int le
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
int FVoxelModel::FindFrame(const char * name)
|
int FVoxelModel::FindFrame(const char * name, bool nodefault)
|
||||||
{
|
{
|
||||||
return 0;
|
return nodefault? FErr_Voxel : 0; // -2, not -1 because voxels are special.
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
|
@ -107,6 +107,16 @@ namespace GC
|
||||||
return obj = NULL;
|
return obj = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handles a read barrier for a const pointer. This does not alter the source data, but only returns NULL if the object is destroyed.
|
||||||
|
template<class T> inline T* ReadBarrier(const T*& obj)
|
||||||
|
{
|
||||||
|
if (obj == NULL || !(obj->ObjectFlags & OF_EuthanizeMe))
|
||||||
|
{
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if it's time to collect, and do a collection step if it is.
|
// Check if it's time to collect, and do a collection step if it is.
|
||||||
static inline void CheckGC()
|
static inline void CheckGC()
|
||||||
{
|
{
|
||||||
|
@ -214,7 +224,13 @@ public:
|
||||||
return GC::ReadBarrier(pp);
|
return GC::ReadBarrier(pp);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr T ForceGet() noexcept //for situations where the read barrier needs to be skipped.
|
constexpr T Get() const noexcept
|
||||||
|
{
|
||||||
|
auto ppp = pp;
|
||||||
|
return GC::ReadBarrier(ppp);
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr T ForceGet() const noexcept //for situations where the read barrier needs to be skipped.
|
||||||
{
|
{
|
||||||
return pp;
|
return pp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -918,7 +918,7 @@ void PFloat::SetValue(void *addr, double val)
|
||||||
|
|
||||||
int PFloat::GetValueInt(void *addr) const
|
int PFloat::GetValueInt(void *addr) const
|
||||||
{
|
{
|
||||||
return xs_ToInt(GetValueFloat(addr));
|
return int(GetValueFloat(addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
8
src/common/thirdparty/math/cmath.h
vendored
8
src/common/thirdparty/math/cmath.h
vendored
|
@ -54,14 +54,14 @@ extern FFastTrig fasttrig;
|
||||||
#define RAD2BAM(f) ((unsigned)xs_CRoundToInt((f) * (0x80000000/3.14159265358979323846)))
|
#define RAD2BAM(f) ((unsigned)xs_CRoundToInt((f) * (0x80000000/3.14159265358979323846)))
|
||||||
|
|
||||||
|
|
||||||
inline double fastcosbam(double v)
|
inline double fastcosbam(unsigned int v)
|
||||||
{
|
{
|
||||||
return fasttrig.cos(xs_CRoundToUInt(v));
|
return fasttrig.cos(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline double fastsinbam(double v)
|
inline double fastsinbam(unsigned int v)
|
||||||
{
|
{
|
||||||
return fasttrig.sin(xs_CRoundToUInt(v));
|
return fasttrig.sin(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline double fastcosdeg(double v)
|
inline double fastcosdeg(double v)
|
||||||
|
|
|
@ -100,7 +100,7 @@ inline void fillshort(void* buff, size_t count, uint16_t clear)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> inline constexpr T Sgn(const T& val) { return (val > 0) - (val < 0); }
|
template<typename T> inline constexpr int Sgn(const T& val) { return (val > 0) - (val < 0); }
|
||||||
|
|
||||||
|
|
||||||
inline int sizeToBits(int w)
|
inline int sizeToBits(int w)
|
||||||
|
|
|
@ -46,6 +46,16 @@ struct IntRect
|
||||||
return top + height;
|
return top + height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Width() const
|
||||||
|
{
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Height() const
|
||||||
|
{
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -141,11 +141,13 @@ struct TVector2
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scalar addition
|
// Scalar addition
|
||||||
|
#if 0
|
||||||
TVector2 &operator+= (double scalar)
|
TVector2 &operator+= (double scalar)
|
||||||
{
|
{
|
||||||
X += scalar, Y += scalar;
|
X += scalar, Y += scalar;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
friend TVector2 operator+ (const TVector2 &v, vec_t scalar)
|
friend TVector2 operator+ (const TVector2 &v, vec_t scalar)
|
||||||
{
|
{
|
||||||
|
@ -341,6 +343,11 @@ struct TVector3
|
||||||
return X == 0 && Y == 0 && Z == 0;
|
return X == 0 && Y == 0 && Z == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TVector3 plusZ(double z)
|
||||||
|
{
|
||||||
|
return { X, Y, Z + z };
|
||||||
|
}
|
||||||
|
|
||||||
TVector3 &operator= (const TVector3 &other) = default;
|
TVector3 &operator= (const TVector3 &other) = default;
|
||||||
|
|
||||||
// Access X and Y and Z as an array
|
// Access X and Y and Z as an array
|
||||||
|
@ -385,11 +392,13 @@ struct TVector3
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scalar addition
|
// Scalar addition
|
||||||
|
#if 0
|
||||||
TVector3 &operator+= (vec_t scalar)
|
TVector3 &operator+= (vec_t scalar)
|
||||||
{
|
{
|
||||||
X += scalar, Y += scalar, Z += scalar;
|
X += scalar, Y += scalar, Z += scalar;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
friend TVector3 operator+ (const TVector3 &v, vec_t scalar)
|
friend TVector3 operator+ (const TVector3 &v, vec_t scalar)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue