mirror of
https://github.com/NoelFB/blah.git
synced 2025-06-29 19:25:26 +08:00
moved Sprite Batcher's default shader to Renderer; no longer a global var
This commit is contained in:
@ -46,9 +46,9 @@ namespace Blah
|
||||
public:
|
||||
|
||||
// The name of the default uniforms to set
|
||||
const char* texture_uniform;
|
||||
const char* sampler_uniform;
|
||||
const char* matrix_uniform;
|
||||
String texture_uniform = "u_texture";
|
||||
String sampler_uniform = "u_texture_sampler";
|
||||
String matrix_uniform = "u_matrix";
|
||||
|
||||
// Snaps all drawing coordinates to integer values
|
||||
// This is useful for drawing Pixel Art stuff
|
||||
@ -57,11 +57,6 @@ namespace Blah
|
||||
// Default Sampler, set on clear
|
||||
TextureSampler default_sampler;
|
||||
|
||||
Batch();
|
||||
Batch(const Batch& other) = delete;
|
||||
Batch& operator=(const Batch& other) = delete;
|
||||
~Batch();
|
||||
|
||||
// Pushes a new matrix onto the stack, and uses it for transforming all drawing.
|
||||
// `absolute` means the matrix provided will not be transformed by the current stack.
|
||||
void push_matrix(const Mat3x2f& matrix, bool absolute = false);
|
||||
@ -199,8 +194,6 @@ namespace Blah
|
||||
u8 wash;
|
||||
u8 fill;
|
||||
u8 pad;
|
||||
|
||||
Vertex() = default;
|
||||
};
|
||||
|
||||
struct DrawBatch
|
||||
@ -224,13 +217,12 @@ namespace Blah
|
||||
scissor(0, 0, -1, -1) {}
|
||||
};
|
||||
|
||||
static ShaderRef m_default_shader;
|
||||
MaterialRef m_default_material;
|
||||
MeshRef m_mesh;
|
||||
Mat3x2f m_matrix;
|
||||
ColorMode m_color_mode;
|
||||
u8 m_tex_mult;
|
||||
u8 m_tex_wash;
|
||||
Mat3x2f m_matrix = Mat3x2f::identity;
|
||||
ColorMode m_color_mode = ColorMode::Normal;
|
||||
u8 m_tex_mult = 255;
|
||||
u8 m_tex_wash = 0;
|
||||
DrawBatch m_batch;
|
||||
Vector<Vertex> m_vertices;
|
||||
Vector<u32> m_indices;
|
||||
@ -241,7 +233,7 @@ namespace Blah
|
||||
Vector<ColorMode> m_color_mode_stack;
|
||||
Vector<int> m_layer_stack;
|
||||
Vector<DrawBatch> m_batches;
|
||||
int m_batch_insert;
|
||||
int m_batch_insert = 0;
|
||||
|
||||
void render_single_batch(RenderPass& pass, const DrawBatch& b, const Mat4x4f& matrix);
|
||||
};
|
||||
|
@ -3,49 +3,49 @@
|
||||
|
||||
namespace Blah
|
||||
{
|
||||
struct Time
|
||||
namespace Time
|
||||
{
|
||||
// ticks per second (microseconds, in this case)
|
||||
static constexpr u64 ticks_per_second = 1000000;
|
||||
constexpr u64 ticks_per_second = 1000000;
|
||||
|
||||
// uptime, in ticks
|
||||
static u64 ticks;
|
||||
extern u64 ticks;
|
||||
|
||||
// uptime, in seconds
|
||||
static double seconds;
|
||||
extern double seconds;
|
||||
|
||||
// previous frame uptime, in ticks
|
||||
static u64 previous_ticks;
|
||||
extern u64 previous_ticks;
|
||||
|
||||
// previous frame uptime, in seconds
|
||||
static double previous_seconds;
|
||||
extern double previous_seconds;
|
||||
|
||||
// delta time from last frame
|
||||
static float delta;
|
||||
extern float delta;
|
||||
|
||||
// time the application should pause for
|
||||
static float pause_timer;
|
||||
extern float pause_timer;
|
||||
|
||||
// pauses the entire application for the given time
|
||||
static void pause_for(float duration);
|
||||
void pause_for(float duration);
|
||||
|
||||
// returns true on the given time interval
|
||||
static bool on_interval(double time, float delta, float interval, float offset);
|
||||
bool on_interval(double time, float delta, float interval, float offset);
|
||||
|
||||
// returns true on the given time interval
|
||||
static bool on_interval(float delta, float interval, float offset);
|
||||
bool on_interval(float delta, float interval, float offset);
|
||||
|
||||
// returns true on the given time interval
|
||||
static bool on_interval(float interval, float offset = 0);
|
||||
bool on_interval(float interval, float offset = 0);
|
||||
|
||||
// returns true when the given timestamp is passed
|
||||
static bool on_time(double time, double timestamp);
|
||||
bool on_time(double time, double timestamp);
|
||||
|
||||
// returns true between time intervals
|
||||
static bool between_interval(double time, float interval, float offset);
|
||||
bool between_interval(double time, float interval, float offset);
|
||||
|
||||
// returns true between time intervals
|
||||
static bool between_interval(float interval, float offset = 0);
|
||||
bool between_interval(float interval, float offset = 0);
|
||||
};
|
||||
|
||||
class Stopwatch
|
||||
|
Reference in New Issue
Block a user