# Rewrite 5

- Move Libraries Source into pd directory and give them all their own CMakeLists.txt
- Partial rewrite core (color, autogenerated vec), lithium (now uses UNIQUE PTR for Commands), UI7
- Use MenuV2 as new standart in UI7
- Implementz ViewPort Pre alpha to UI7
- Add Line Drawing to DrawList (not Working)
- Implement a Complete new drievrs API (static Drivers)
- NO SUPPORT FOR SHARED LIBRARY BUILDS IN VERSION 5 YET
- Add Tools to Autogenerate Headers and Stuff
This commit is contained in:
2025-06-22 21:05:09 +02:00
parent 963fa72e41
commit 57634cbf4b
184 changed files with 13967 additions and 18453 deletions

View File

@ -1,76 +0,0 @@
#pragma once
/*
MIT License
Copyright (c) 2024 - 2025 tobid7
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include <pd/core/core.hpp>
#include <pd/lithium/command.hpp>
#include <pd/lithium/rect.hpp>
#include <pd/lithium/texture.hpp>
using LIBackendFlags = PD::u32;
enum LIBackendFlags_ {
LIBackendFlags_None = 0,
LIBackendFlags_FlipUV_Y = 1 << 0, // Essential for Font Loading
};
namespace PD {
namespace LI {
class Backend {
public:
Backend(const std::string& name = "NullBackend") : pName(name) {}
~Backend() = default;
// Using Legacy SmartCTOR API here
PD_SMART_CTOR(Backend)
virtual void Init() {}
virtual void Deinit() {}
virtual void NewFrame() {}
virtual void BindTexture(TexAddress addr) {}
virtual void RenderDrawData(const Vec<Command::Ref>& Commands) {}
virtual Texture::Ref LoadTexture(
const std::vector<PD::u8>& pixels, int w, int h,
Texture::Type type = Texture::Type::RGBA32,
Texture::Filter filter = Texture::Filter::LINEAR) {
// Texture loading not supported (when this func not get override)
return nullptr;
}
/** Backend identification name */
const std::string pName = "NullBackend";
LIBackendFlags Flags = 0;
ivec2 ViewPort;
fvec4 ClearColor;
// Optional Index Counter
int IndexCounter = 0;
// Optional Vertex Counter
int VertexCounter = 0;
// Optional Frame Counter
int FrameCounter = 0;
};
} // namespace LI
} // namespace PD

28
include/pd/lithium/command.hpp Normal file → Executable file
View File

@ -2,8 +2,7 @@
/*
MIT License
Copyright (c) 2024 - 2025 tobid7
Copyright (c) 2024 - 2025 René Amthor (tobid7)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -25,38 +24,35 @@ SOFTWARE.
*/
#include <pd/core/core.hpp>
// #include <pd/lithium/flags.hpp>
#include <pd/lithium/texture.hpp>
#include <pd/lithium/vertex.hpp>
namespace PD {
namespace LI {
/**
* Lithium Draw Command (containing a list of vertex and index data
* only for this specific command itself)
*/
class Command : public SmartCtor<Command> {
namespace Li {
class Command {
public:
Command() = default;
~Command() = default;
Command& AppendIndex(u16 idx) {
PD_UNIQUE(Command);
Command& AddIdx(const u16& idx) {
IndexBuffer.Add(VertexBuffer.Size() + idx);
return *this;
}
Command& AppendVertex(const Vertex& v) {
VertexBuffer.Add(v);
Command& AddVtx(const Vertex& v) {
VertexBuffer.Add(std::move(v));
return *this;
}
Vec<Vertex> VertexBuffer;
Vec<u16> IndexBuffer;
PD::Vec<Vertex> VertexBuffer;
PD::Vec<u16> IndexBuffer;
ivec4 ScissorRect;
bool ScissorEnabled = false;
bool ScissorOn = false;
int Layer;
int Index;
Texture::Ref Tex;
};
} // namespace LI
} // namespace Li
} // namespace PD

84
include/pd/lithium/drawlist.hpp Normal file → Executable file
View File

@ -28,24 +28,47 @@ SOFTWARE.
#include <pd/lithium/font.hpp>
#include <pd/lithium/pd_p_api.hpp>
/** Path Rect Flags */
using LiPathRectFlags = PD::u32;
/** Setup for everything (oder so) */
enum LiPathRectFlags_ : PD::u32 {
LiPathRectFlags_None = 0,
LiPathRectFlags_KeepTopLeft = PD_BIT(0),
LiPathRectFlags_KeepTopRight = PD_BIT(1),
LiPathRectFlags_KeepBotRight = PD_BIT(2),
LiPathRectFlags_KeepBotLeft = PD_BIT(3),
LiPathRectFlags_KeepTop = PD_BIT(0) | PD_BIT(1),
LiPathRectFlags_KeepBot = PD_BIT(2) | PD_BIT(3),
LiPathRectFlags_KeepLeft = PD_BIT(0) | PD_BIT(3),
LiPathRectFlags_KeepRight = PD_BIT(1) | PD_BIT(2),
};
namespace PD {
namespace LI {
class PD_LITHIUM_API DrawList : public SmartCtor<DrawList> {
namespace Li {
class PD_LITHIUM_API DrawList {
public:
DrawList(Texture::Ref solid) {
WhitePixel = solid;
CurrentTex = solid;
}
~DrawList() {}
DrawList() { DrawSolid(); }
~DrawList() { pDrawList.clear(); }
/** Require Copy and Move Constructors */
DrawList(const DrawList&) = delete;
DrawList& operator=(const DrawList&) = delete;
DrawList(DrawList&&) noexcept = default;
DrawList& operator=(DrawList&&) noexcept = default;
PD_SHARED(DrawList);
Command::Ref PreGenerateCmd();
void AddCommand(Command::Ref v) { pDrawList.Add(v); }
void Clear() { pDrawList.Clear(); }
void AddCommand(Command::Ref v) { pDrawList.push_back(std::move(v)); }
void Clear() { pDrawList.clear(); }
void SetFont(Font::Ref font) { pCurrentFont = font; }
void SetFontScale(float scale) { pFontScale = scale; }
void DrawSolid() { CurrentTex = WhitePixel; }
void DrawSolid();
void DrawTexture(Texture::Ref tex) { CurrentTex = tex; }
// SECTION: Draw API //
@ -62,7 +85,12 @@ class PD_LITHIUM_API DrawList : public SmartCtor<DrawList> {
void DrawCircleFilled(const fvec2& center, float rad, u32 color,
int num_segments);
void DrawText(const fvec2& p, const std::string& text, u32 color);
/**
* Extended Draw Text Function
*/
void DrawTextEx(const fvec2& p, const std::string& text, u32 color,
LiTextFlags flags, fvec2 box = fvec2(0.f));
void DrawLine(const fvec2& a, const fvec2& b, u32 color, int t = 1);
/**
* Take list of points and display it as a line on screen
* @param points List of Positions
@ -126,20 +154,38 @@ class PD_LITHIUM_API DrawList : public SmartCtor<DrawList> {
}
void PathArcToN(const fvec2& c, float radius, float a_min, float a_max,
int segments);
void PathFastArcToN(const fvec2& c, float r, float amin, float amax, int s);
/// @brief Create a Path Rect (uses to Positions instead of Pos/Size)
/// @param a Top Left Position
/// @param b Bottom Right Position
/// @param rounding rounding
void PathRect(fvec2 a, fvec2 b, float rounding = 0.f);
/// @brief Create a Path Rect (uses to Positions instead of Pos/Size)
/// @param a Top Left Position
/// @param b Bottom Right Position
/// @param rounding rounding
/// @param flags DrawFlags (for special rounding rules)
void PathRect(fvec2 a, fvec2 b, float rounding = 0.f, u32 flags = 0);
void PathRectEx(fvec2 a, fvec2 b, float rounding = 0.f, u32 flags = 0);
int Layer = 0;
void PushClipRect(const fvec4& cr) { pClipRects.Push(cr); }
void PopClipRect() {
if (pClipRects.IsEmpty()) {
return;
}
pClipRects.Pop();
}
/** One linear Clip rect Setup */
void pClipCmd(Command* cmd);
/** Data Section */
Stack<fvec4> pClipRects;
int Layer;
float pFontScale = 0.7f;
Font::Ref pCurrentFont = nullptr;
Texture::Ref CurrentTex = nullptr;
Texture::Ref WhitePixel = nullptr;
PD::Vec<Command::Ref> pDrawList;
Font::Ref pCurrentFont;
Texture::Ref CurrentTex;
std::vector<Command::Ref> pDrawList;
PD::Vec<fvec2> pPath;
};
} // namespace LI
} // namespace PD
} // namespace Li
} // namespace PD

51
include/pd/lithium/font.hpp Normal file → Executable file
View File

@ -25,26 +25,25 @@ SOFTWARE.
*/
#include <pd/core/core.hpp>
#include <pd/lithium/backend.hpp>
#include <pd/lithium/command.hpp>
#include <pd/lithium/pd_p_api.hpp>
#include <pd/lithium/rect.hpp>
#include <pd/lithium/texture.hpp>
using LITextFlags = PD::u32;
enum LITextFlags_ {
LITextFlags_None = 0, ///< Do nothing
LITextFlags_AlignRight = 1 << 0, ///< Align Right of position
LITextFlags_AlignMid = 1 << 1, ///< Align in the middle of pos and box
LITextFlags_Shaddow = 1 << 2, ///< Draws the text twice to create shaddow
LITextFlags_Wrap = 1 << 3, ///< Wrap Text: May be runs better with TMS
LITextFlags_Short = 1 << 4, ///< Short Text: May be runs better with TMS
LITextFlags_Scroll = 1 << 5, ///< Not implemented [scoll text if to long]
using LiTextFlags = PD::u32;
enum LiTextFlags_ {
LiTextFlags_None = 0, ///< Do nothing
LiTextFlags_AlignRight = 1 << 0, ///< Align Right of position
LiTextFlags_AlignMid = 1 << 1, ///< Align in the middle of pos and box
LiTextFlags_Shaddow = 1 << 2, ///< Draws the text twice to create shaddow
LiTextFlags_Wrap = 1 << 3, ///< Wrap Text: May be runs better with TMS
LiTextFlags_Short = 1 << 4, ///< Short Text: May be runs better with TMS
LiTextFlags_Scroll = 1 << 5, ///< Not implemented [scoll text if to long]
};
namespace PD {
namespace LI {
/** Font Loader for Lithium */
class PD_LITHIUM_API Font : public SmartCtor<Font> {
namespace Li {
class PD_LITHIUM_API Font {
public:
/** Codepoint Data holder */
struct Codepoint {
@ -55,8 +54,13 @@ class PD_LITHIUM_API Font : public SmartCtor<Font> {
float Offset = 0.f;
bool pInvalid = false;
};
Font(Backend::Ref backend) { pBackend = backend; };
/** Constructore doesnt need Backand anymore */
Font() = default;
~Font() = default;
PD_SHARED(Font);
/**
* Load a TTF File
* @param path Path to the TTF file
@ -76,20 +80,19 @@ class PD_LITHIUM_API Font : public SmartCtor<Font> {
/**
* Extended Draw Text Function that vreates a Command List
*/
void CmdTextEx(Vec<Command::Ref>& cmds, const fvec2& pos, u32 color,
float scale, const std::string& text, LITextFlags flags = 0,
void CmdTextEx(std::vector<Command::Ref>& cmds, const fvec2& pos, u32 color,
float scale, const std::string& text, LiTextFlags flags = 0,
const fvec2& box = 0);
/** Pixelheight */
/** Data Section */
int PixelHeight;
int DefaultPixelHeight = 24;
private:
/** List of textures (codepoints are using) */
std::vector<Texture::Ref> Textures;
/** 32Bit Codepoint Dataholder Reference Map */
std::map<u32, Codepoint> CodeMap;
Backend::Ref pBackend = nullptr;
/**
* 32Bit Codepoint Dataholder reference map
* **Now using unordered map**
*/
std::unordered_map<u32, Codepoint> CodeMap;
};
} // namespace LI
} // namespace Li
} // namespace PD

32
include/pd/lithium/lithium.hpp Executable file
View File

@ -0,0 +1,32 @@
#pragma once
/*
MIT License
Copyright (c) 2024 - 2025 tobid7
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include <pd/lithium/command.hpp>
#include <pd/lithium/drawlist.hpp>
#include <pd/lithium/font.hpp>
#include <pd/lithium/rect.hpp>
#include <pd/lithium/renderer.hpp>
#include <pd/lithium/texture.hpp>

9
include/pd/lithium/pd_p_api.hpp Normal file → Executable file
View File

@ -2,8 +2,7 @@
/*
MIT License
Copyright (c) 2024 - 2025 tobid7
Copyright (c) 2024 - 2025 René Amthor (tobid7)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -22,9 +21,9 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
*/
#pragma once
/** Generated with ppam */
#ifdef _WIN32 // Windows (MSVC Tested)
#ifdef PD_LITHIUM_BUILD_SHARED
@ -49,4 +48,4 @@ SOFTWARE.
#define PD_LITHIUM_API
#else
#define PD_LITHIUM_API
#endif
#endif

105
include/pd/lithium/rect.hpp Normal file → Executable file
View File

@ -26,24 +26,20 @@ SOFTWARE.
#include <pd/core/core.hpp>
namespace PD {
namespace LI {
/**
* Container that holds position of a rectangle's corners.
*/
namespace Li {
class Rect {
public:
Rect() = default;
Rect() : Top(0), Bot(0) {}
~Rect() = default;
/**
* Constructor that initializes the rectangle using top and bottom positions.
* @param t Top left and right corner positions.
* @param b Bottom left and right corner positions.
*/
Rect(const fvec4& t, const fvec4& b) {
top = t;
bot = b;
Top = t;
Bot = b;
}
/**
* Constructor that initializes the rectangle using individual corner
* positions.
@ -53,8 +49,8 @@ class Rect {
* @param br Bottom right corner position.
*/
Rect(const fvec2& tl, const fvec2& tr, const fvec2& bl, const fvec2& br) {
top = fvec4(tl, tr);
bot = fvec4(bl, br);
Top = fvec4(tl, tr);
Bot = fvec4(bl, br);
}
/**
@ -66,67 +62,30 @@ class Rect {
* @param uv Vec4 UV map.
*/
Rect(const fvec4& uv) {
top = vec4(uv.x, uv.y, uv.z, uv.y);
bot = vec4(uv.x, uv.w, uv.z, uv.w);
}
~Rect() = default;
/**
* Get the top left and right corner positions.
* @return Top positions.
*/
fvec4 Top() const { return top; }
/**
* Get the bottom left and right corner positions.
* @return Bottom positions.
*/
fvec4 Bot() const { return bot; }
/**
* Set the top left and right corner positions.
* @param v New top positions.
* @return Reference to the updated Rect.
*/
Rect& Top(const fvec4& v) {
top = v;
return *this;
}
/**
* Set the bottom left and right corner positions.
* @param v New bottom positions.
* @return Reference to the updated Rect.
*/
Rect& Bot(const fvec4& v) {
bot = v;
return *this;
Top = vec4(uv.x, uv.y, uv.z, uv.y);
Bot = vec4(uv.x, uv.w, uv.z, uv.w);
}
/**
* Get the top-left corner position.
* @return Top-left position as vec2.
*/
fvec2 TopLeft() const { return vec2(top.x, top.y); }
fvec2 TopLeft() const { return fvec2(Top.x, Top.y); }
/**
* Get the top-right corner position.
* @return Top-right position as vec2.
*/
fvec2 TopRight() const { return vec2(top.z, top.w); }
fvec2 TopRight() const { return fvec2(Top.z, Top.w); }
/**
* Get the bottom-left corner position.
* @return Bottom-left position as vec2.
*/
fvec2 BotLeft() const { return vec2(bot.x, bot.y); }
fvec2 BotLeft() const { return fvec2(Bot.x, Bot.y); }
/**
* Get the bottom-right corner position.
* @return Bottom-right position as vec2.
*/
fvec2 BotRight() const { return vec2(bot.z, bot.w); }
fvec2 BotRight() const { return fvec2(Bot.z, Bot.y); }
/**
* Set the top-left corner position.
@ -134,8 +93,8 @@ class Rect {
* @return Reference to the updated Rect.
*/
Rect& TopLeft(const fvec2& v) {
top.x = v.x;
top.y = v.y;
Top.x = v.x;
Top.y = v.y;
return *this;
}
@ -145,8 +104,8 @@ class Rect {
* @return Reference to the updated Rect.
*/
Rect& TopRight(const fvec2& v) {
top.z = v.x;
top.w = v.y;
Top.z = v.x;
Top.w = v.y;
return *this;
}
@ -156,8 +115,8 @@ class Rect {
* @return Reference to the updated Rect.
*/
Rect& BotLeft(const fvec2& v) {
bot.x = v.x;
bot.y = v.y;
Bot.x = v.x;
Bot.y = v.y;
return *this;
}
@ -167,26 +126,22 @@ class Rect {
* @return Reference to the updated Rect.
*/
Rect& BotRight(const fvec2& v) {
bot.z = v.x;
bot.w = v.y;
Bot.z = v.x;
Bot.w = v.y;
return *this;
}
/**
* Swap X and Y coordinates for all corners.
*
* - Used in SpiteSheet for the rotated images.
*/
void SwapVec2XY() {
top.SwapXY();
top.SwapZW();
bot.SwapXY();
bot.SwapZW();
Top.SwapXY();
Top.SwapZW();
Bot.SwapXY();
Bot.SwapZW();
}
private:
fvec4 top; ///< Top left and right corner positions.
fvec4 bot; ///< Bottom left and right corner positions.
/** Data Section */
fvec4 Top;
fvec4 Bot;
};
} // namespace LI
} // namespace Li
} // namespace PD

43
include/pd/lithium/renderer.hpp Normal file → Executable file
View File

@ -24,37 +24,31 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include <pd/lithium/backend.hpp>
#include <pd/lithium/drawlist.hpp>
#include <pd/lithium/font.hpp>
#include <pd/drivers/drivers.hpp>
#include <pd/lithium/pd_p_api.hpp>
#include <pd/lithium/rect.hpp>
namespace PD {
namespace LI {
class PD_LITHIUM_API Renderer : public SmartCtor<Renderer> {
namespace Li {
/**
* Static Class Render Setup Functions
*/
class PD_LITHIUM_API Renderer {
public:
Renderer(Backend::Ref backend);
Renderer() = default;
~Renderer() = default;
void Render();
// SECTION: ADVANCED API
void AddCommand(Command::Ref v) { DrawList.Add(v); }
void RegisterDrawList(DrawList::Ref list) { pDrawLists.Add(list); }
Command::Ref PreGenerateCmd();
// SECTION: Open Command and Object creation API
static void RotateCorner(fvec2& pos, float sinus, float cosinus);
static void RotateCorner(fvec2& pos, float s, float c);
static Rect PrimRect(const fvec2& pos, const fvec2& size, float angle = 0.f);
static Rect PrimLine(const fvec2& a, const fvec2& b, int thickness = 1);
static void CmdQuad(Command::Ref cmd, const Rect& quad, const Rect& uv,
static void CmdQuad(Command* cmd, const Rect& quad, const Rect& uv,
u32 color);
static void CmdTriangle(Command::Ref cmd, const fvec2 a, const fvec2 b,
static void CmdTriangle(Command* cmd, const fvec2 a, const fvec2 b,
const fvec2 c, u32 clr);
static void CmdPolyLine(const Vec<fvec2>& points, u32 clr, u32 flags = 0,
int thickness = 1);
static void CmdConvexPolyFilled(Command::Ref cmd, const Vec<fvec2>& points,
static void CmdConvexPolyFilled(Command* cmd, const Vec<fvec2>& points,
u32 clr, Texture::Ref tex);
// SECTION: InBounds Checks
@ -63,17 +57,6 @@ class PD_LITHIUM_API Renderer : public SmartCtor<Renderer> {
static bool InBox(const fvec2& pos, const fvec4& area);
static bool InBox(const fvec2& a, const fvec2& b, const fvec2& c,
const fvec4& area);
// SECTION: Data //
Texture::Ref WhitePixel = nullptr;
Backend::Ref pBackend = nullptr;
Texture::Ref CurrentTex = nullptr;
int Layer = 0;
private:
PD::Vec<Command::Ref> DrawList;
PD::Vec<DrawList::Ref> pDrawLists;
};
} // namespace LI
} // namespace Li
} // namespace PD

39
include/pd/lithium/texture.hpp Normal file → Executable file
View File

@ -2,8 +2,7 @@
/*
MIT License
Copyright (c) 2024 - 2025 tobid7
Copyright (c) 2024 - 2025 René Amthor (tobid7)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -28,49 +27,49 @@ SOFTWARE.
#include <pd/lithium/rect.hpp>
namespace PD {
namespace LI {
namespace Li {
/** Use so address type for TexAddress */
using TexAddress = uintptr_t;
/**
* Lithium Texture Data Holder
* Memory management is handled by backend
*/
class Texture : public SmartCtor<Texture> {
class Texture {
public:
/** Texture Type */
/** Texture Types */
enum Type {
RGBA32, ///< RGBA 32
RGB24, ///< RGB24
A8, ///< A8
RGBA32, ///< Rgba 32Bit
RGB24, ///< Rgb 24 Bit
A8, ///< A8 8Bit alpha
};
/** Texture Filters */
enum Filter {
NEAREST, ///< Nearest
LINEAR, ///< Linear
};
/** Default constructor */
Texture() : UV(0.f, 0.f, 1.f, 1.f) {}
/** Constructor */
Texture() : Address(0), Size(0), UV(fvec4(0.f, 0.f, 1.f, 1.f)) {}
Texture(TexAddress addr, ivec2 size,
LI::Rect uv = fvec4(0.f, 0.f, 1.f, 1.f)) {
Li::Rect uv = fvec4(0.f, 0.f, 1.f, 1.f)) {
Address = addr;
Size = size;
UV = uv;
}
void CopyOther(Texture::Ref tex) {
PD_SHARED(Texture);
void CopyFrom(Texture::Ref tex) {
Address = tex->Address;
Size = tex->Size;
UV = tex->UV;
}
/** Left in Code getter (should be remoevd) */
ivec2 GetSize() const { return Size; }
LI::Rect GetUV() const { return UV; }
Li::Rect GetUV() const { return UV; }
operator ivec2() const { return Size; }
operator LI::Rect() const { return UV; }
operator Li::Rect() const { return UV; }
TexAddress Address;
ivec2 Size;
LI::Rect UV;
Li::Rect UV;
};
} // namespace LI
} // namespace Li
} // namespace PD

10
include/pd/lithium/vertex.hpp Normal file → Executable file
View File

@ -2,8 +2,7 @@
/*
MIT License
Copyright (c) 2024 - 2025 tobid7
Copyright (c) 2024 - 2025 René Amthor (tobid7)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -27,7 +26,7 @@ SOFTWARE.
#include <pd/core/core.hpp>
namespace PD {
namespace LI {
namespace Li {
class Vertex {
public:
Vertex() {}
@ -40,9 +39,12 @@ class Vertex {
~Vertex() {}
// private:
/** Open Access Data Section */
fvec2 Pos;
fvec2 UV;
u32 Color;
};
} // namespace LI
} // namespace Li
} // namespace PD