fix: optimization: PVS-Studio warning V813
Passing large objects by const reference avoids unnecessary copying and enhances efficiency. Reported by: PVS-Studio Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
This commit is contained in:
parent
5b325ac2bc
commit
2c1103307f
@ -40,7 +40,8 @@ namespace AL {
|
||||
/// @param field enum value
|
||||
/// @param def default value will be returned in case of error
|
||||
/// @return field value or default
|
||||
inline glm::vec3 getSource3f(uint source, ALenum field, glm::vec3 def={}) {
|
||||
inline glm::vec3 getSource3f(uint source, ALenum field, const glm::vec3& def= {}
|
||||
) {
|
||||
glm::vec3 value = def;
|
||||
if (source == 0)
|
||||
return def;
|
||||
|
||||
@ -210,10 +210,10 @@ std::unique_ptr<Stream> audio::open_stream(std::shared_ptr<PCMStream> stream, bo
|
||||
|
||||
|
||||
void audio::set_listener(
|
||||
glm::vec3 position,
|
||||
glm::vec3 velocity,
|
||||
glm::vec3 lookAt,
|
||||
glm::vec3 up
|
||||
const glm::vec3& position,
|
||||
const glm::vec3& velocity,
|
||||
const glm::vec3& lookAt,
|
||||
const glm::vec3& up
|
||||
) {
|
||||
backend->setListener(position, velocity, lookAt, up);
|
||||
}
|
||||
@ -310,7 +310,7 @@ speakerid_t audio::play(
|
||||
|
||||
speakerid_t audio::play_stream(
|
||||
const fs::path& file,
|
||||
glm::vec3 position,
|
||||
const glm::vec3& position,
|
||||
bool relative,
|
||||
float volume,
|
||||
float pitch,
|
||||
|
||||
@ -399,10 +399,10 @@ namespace audio {
|
||||
/// @param lookAt point the listener look at
|
||||
/// @param up camera up vector
|
||||
void set_listener(
|
||||
glm::vec3 position,
|
||||
glm::vec3 velocity,
|
||||
glm::vec3 lookAt,
|
||||
glm::vec3 up
|
||||
const glm::vec3& position,
|
||||
const glm::vec3& velocity,
|
||||
const glm::vec3& lookAt,
|
||||
const glm::vec3& up
|
||||
);
|
||||
|
||||
/// @brief Play 3D sound in the world
|
||||
@ -457,7 +457,7 @@ namespace audio {
|
||||
/// @return speaker id or 0
|
||||
speakerid_t play_stream(
|
||||
const fs::path& file,
|
||||
glm::vec3 position,
|
||||
const glm::vec3& position,
|
||||
bool relative,
|
||||
float volume,
|
||||
float pitch,
|
||||
|
||||
@ -119,7 +119,7 @@ public:
|
||||
|
||||
static constexpr size_t MISSING = SIZE_MAX;
|
||||
|
||||
void add(std::string name, dynamic::Map_sptr map) {
|
||||
void add(const std::string& name, dynamic::Map_sptr map) {
|
||||
indices[name] = names.size();
|
||||
names.push_back(name);
|
||||
savedData->push_back(map);
|
||||
|
||||
@ -118,34 +118,34 @@ namespace dynamic {
|
||||
List_sptr list(const std::string& key) const;
|
||||
void flag(const std::string& key, bool& dst) const;
|
||||
|
||||
Map& put(std::string key, std::unique_ptr<Map> value) {
|
||||
Map& put(const std::string& key, std::unique_ptr<Map> value) {
|
||||
return put(key, Map_sptr(value.release()));
|
||||
}
|
||||
Map& put(std::string key, std::unique_ptr<List> value) {
|
||||
Map& put(const std::string& key, std::unique_ptr<List> value) {
|
||||
return put(key, List_sptr(value.release()));
|
||||
}
|
||||
Map& put(std::string key, int value) {
|
||||
Map& put(const std::string& key, int value) {
|
||||
return put(key, Value(static_cast<integer_t>(value)));
|
||||
}
|
||||
Map& put(std::string key, unsigned int value) {
|
||||
Map& put(const std::string& key, unsigned int value) {
|
||||
return put(key, Value(static_cast<integer_t>(value)));
|
||||
}
|
||||
Map& put(std::string key, int64_t value) {
|
||||
Map& put(const std::string& key, int64_t value) {
|
||||
return put(key, Value(static_cast<integer_t>(value)));
|
||||
}
|
||||
Map& put(std::string key, uint64_t value) {
|
||||
Map& put(const std::string& key, uint64_t value) {
|
||||
return put(key, Value(static_cast<integer_t>(value)));
|
||||
}
|
||||
Map& put(std::string key, float value) {
|
||||
Map& put(const std::string& key, float value) {
|
||||
return put(key, Value(static_cast<number_t>(value)));
|
||||
}
|
||||
Map& put(std::string key, double value) {
|
||||
Map& put(const std::string& key, double value) {
|
||||
return put(key, Value(static_cast<number_t>(value)));
|
||||
}
|
||||
Map& put(std::string key, bool value) {
|
||||
Map& put(const std::string& key, bool value) {
|
||||
return put(key, Value(static_cast<bool>(value)));
|
||||
}
|
||||
Map& put(std::string key, const char* value) {
|
||||
Map& put(const std::string& key, const char* value) {
|
||||
return put(key, Value(value));
|
||||
}
|
||||
Map& put(const std::string& key, const Value& value);
|
||||
|
||||
@ -55,7 +55,7 @@ static void add_world_generators() {
|
||||
WorldGenerators::addGenerator<FlatWorldGenerator>("core:flat");
|
||||
}
|
||||
|
||||
static void create_channel(Engine* engine, std::string name, NumberSetting& setting) {
|
||||
static void create_channel(Engine* engine, const std::string& name, NumberSetting& setting) {
|
||||
if (name != "master") {
|
||||
audio::create_channel(name);
|
||||
}
|
||||
|
||||
@ -196,7 +196,7 @@ ubyte* WorldRegions::getData(int x, int z, int layer, uint32_t& size) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
regfile_ptr WorldRegions::useRegFile(glm::ivec3 coord) {
|
||||
regfile_ptr WorldRegions::useRegFile(const glm::ivec3& coord) {
|
||||
auto* file = openRegFiles[coord].get();
|
||||
file->inUse = true;
|
||||
return regfile_ptr(file, ®FilesCv);
|
||||
@ -208,7 +208,7 @@ void WorldRegions::closeRegFile(glm::ivec3 coord) {
|
||||
}
|
||||
|
||||
// Marks regfile as used and unmarks when shared_ptr dies
|
||||
regfile_ptr WorldRegions::getRegFile(glm::ivec3 coord, bool create) {
|
||||
regfile_ptr WorldRegions::getRegFile(const glm::ivec3& coord, bool create) {
|
||||
{
|
||||
std::lock_guard lock(regFilesMutex);
|
||||
const auto found = openRegFiles.find(coord);
|
||||
@ -225,7 +225,7 @@ regfile_ptr WorldRegions::getRegFile(glm::ivec3 coord, bool create) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
regfile_ptr WorldRegions::createRegFile(glm::ivec3 coord) {
|
||||
regfile_ptr WorldRegions::createRegFile(const glm::ivec3& coord) {
|
||||
fs::path file = layers[coord[2]].folder/getRegionFilename(coord[0], coord[1]);
|
||||
if (!fs::exists(file)) {
|
||||
return nullptr;
|
||||
@ -352,7 +352,7 @@ static std::unique_ptr<ubyte[]> write_inventories(Chunk* chunk, uint& datasize)
|
||||
}
|
||||
|
||||
/// @brief Store chunk data (voxels and lights) in region (existing or new)
|
||||
void WorldRegions::put(Chunk* chunk, std::vector<ubyte> entitiesData){
|
||||
void WorldRegions::put(Chunk* chunk, const std::vector<ubyte>& entitiesData){
|
||||
assert(chunk != nullptr);
|
||||
if (!chunk->flags.lighted) {
|
||||
return;
|
||||
|
||||
@ -149,10 +149,10 @@ class WorldRegions {
|
||||
|
||||
ubyte* getData(int x, int z, int layer, uint32_t& size);
|
||||
|
||||
regfile_ptr getRegFile(glm::ivec3 coord, bool create=true);
|
||||
regfile_ptr getRegFile(const glm::ivec3& coord, bool create=true);
|
||||
void closeRegFile(glm::ivec3 coord);
|
||||
regfile_ptr useRegFile(glm::ivec3 coord);
|
||||
regfile_ptr createRegFile(glm::ivec3 coord);
|
||||
regfile_ptr useRegFile(const glm::ivec3& coord);
|
||||
regfile_ptr createRegFile(const glm::ivec3& coord);
|
||||
|
||||
fs::path getRegionFilename(int x, int y) const;
|
||||
|
||||
@ -172,7 +172,7 @@ public:
|
||||
~WorldRegions();
|
||||
|
||||
/// @brief Put all chunk data to regions
|
||||
void put(Chunk* chunk, std::vector<ubyte> entitiesData);
|
||||
void put(Chunk* chunk, const std::vector<ubyte>& entitiesData);
|
||||
|
||||
/// @brief Store data in specified region
|
||||
/// @param x chunk.x
|
||||
|
||||
@ -314,7 +314,7 @@ void Hud::openInventory() {
|
||||
}
|
||||
|
||||
void Hud::openInventory(
|
||||
glm::ivec3 block,
|
||||
const glm::ivec3& block,
|
||||
UiDocument* doc,
|
||||
std::shared_ptr<Inventory> blockinv,
|
||||
bool playerInventory
|
||||
|
||||
@ -140,12 +140,12 @@ public:
|
||||
/// @brief Show block inventory in inventory-mode
|
||||
/// @param block block position
|
||||
/// @param doc block ui layout
|
||||
/// @param blockInv block inventory
|
||||
/// @param blockinv block inventory
|
||||
/// @param playerInventory show player inventory too
|
||||
void openInventory(
|
||||
glm::ivec3 block,
|
||||
const glm::ivec3& block,
|
||||
UiDocument* doc,
|
||||
std::shared_ptr<Inventory> blockInv,
|
||||
std::shared_ptr<Inventory> blockinv,
|
||||
bool playerInventory
|
||||
);
|
||||
|
||||
|
||||
@ -59,8 +59,8 @@ void Batch2D::vertex(
|
||||
buffer[index++] = a;
|
||||
}
|
||||
void Batch2D::vertex(
|
||||
glm::vec2 point,
|
||||
glm::vec2 uvpoint,
|
||||
const glm::vec2& point,
|
||||
const glm::vec2& uvpoint,
|
||||
float r, float g, float b, float a
|
||||
) {
|
||||
buffer[index++] = point.x;
|
||||
@ -138,7 +138,7 @@ void Batch2D::rect(
|
||||
UVRegion region,
|
||||
bool flippedX,
|
||||
bool flippedY,
|
||||
glm::vec4 tint
|
||||
const glm::vec4& tint
|
||||
) {
|
||||
if (index + 6*B2D_VERTEX_SIZE >= capacity) {
|
||||
flush();
|
||||
@ -322,11 +322,13 @@ void Batch2D::rect(
|
||||
vertex(v1, glm::vec2(0, 0), r2,g2,b2,1.0f);
|
||||
}
|
||||
|
||||
void Batch2D::sprite(float x, float y, float w, float h, const UVRegion& region, glm::vec4 tint){
|
||||
void Batch2D::sprite(float x, float y, float w, float h, const UVRegion& region,
|
||||
const glm::vec4& tint){
|
||||
rect(x, y, w, h, region.u1, region.v1, region.u2-region.u1, region.v2-region.v1, tint.r, tint.g, tint.b, tint.a);
|
||||
}
|
||||
|
||||
void Batch2D::sprite(float x, float y, float w, float h, int atlasRes, int index, glm::vec4 tint){
|
||||
void Batch2D::sprite(float x, float y, float w, float h, int atlasRes, int index,
|
||||
const glm::vec4& tint){
|
||||
float scale = 1.0f / (float)atlasRes;
|
||||
float u = (index % atlasRes) * scale;
|
||||
float v = 1.0f - ((index / atlasRes) * scale) - scale;
|
||||
|
||||
@ -31,8 +31,8 @@ class Batch2D : public Flushable {
|
||||
);
|
||||
|
||||
void vertex(
|
||||
glm::vec2 point,
|
||||
glm::vec2 uvpoint,
|
||||
const glm::vec2& point,
|
||||
const glm::vec2& uvpoint,
|
||||
float r, float g, float b, float a
|
||||
);
|
||||
|
||||
@ -44,11 +44,13 @@ public:
|
||||
void texture(Texture* texture);
|
||||
void untexture();
|
||||
void setRegion(UVRegion region);
|
||||
void sprite(float x, float y, float w, float h, const UVRegion& region, glm::vec4 tint);
|
||||
void sprite(float x, float y, float w, float h, int atlasRes, int index, glm::vec4 tint);
|
||||
void sprite(float x, float y, float w, float h, const UVRegion& region,
|
||||
const glm::vec4& tint);
|
||||
void sprite(float x, float y, float w, float h, int atlasRes, int index,
|
||||
const glm::vec4& tint);
|
||||
void point(float x, float y, float r, float g, float b, float a);
|
||||
|
||||
inline void setColor(glm::vec4 color) {
|
||||
inline void setColor(const glm::vec4& color) {
|
||||
this->color = color;
|
||||
}
|
||||
inline glm::vec4 getColor() const {
|
||||
@ -69,7 +71,7 @@ public:
|
||||
float ox, float oy,
|
||||
float angle, UVRegion region,
|
||||
bool flippedX, bool flippedY,
|
||||
glm::vec4 tint
|
||||
const glm::vec4& tint
|
||||
);
|
||||
|
||||
void rect(float x, float y, float w, float h);
|
||||
|
||||
@ -51,7 +51,7 @@ void Batch3D::vertex(
|
||||
buffer[index++] = a;
|
||||
}
|
||||
void Batch3D::vertex(
|
||||
glm::vec3 coord, float u, float v,
|
||||
const glm::vec3& coord, float u, float v,
|
||||
float r, float g, float b, float a
|
||||
) {
|
||||
buffer[index++] = coord.x;
|
||||
@ -65,8 +65,8 @@ void Batch3D::vertex(
|
||||
buffer[index++] = a;
|
||||
}
|
||||
void Batch3D::vertex(
|
||||
glm::vec3 point,
|
||||
glm::vec2 uvpoint,
|
||||
const glm::vec3& point,
|
||||
const glm::vec2& uvpoint,
|
||||
float r, float g, float b, float a
|
||||
) {
|
||||
buffer[index++] = point.x;
|
||||
@ -118,12 +118,12 @@ void Batch3D::texture(Texture* new_texture){
|
||||
}
|
||||
|
||||
void Batch3D::sprite(
|
||||
glm::vec3 pos,
|
||||
glm::vec3 up,
|
||||
glm::vec3 right,
|
||||
const glm::vec3& pos,
|
||||
const glm::vec3& up,
|
||||
const glm::vec3& right,
|
||||
float w, float h,
|
||||
const UVRegion& uv,
|
||||
glm::vec4 color
|
||||
const UVRegion& uv,
|
||||
const glm::vec4& color
|
||||
){
|
||||
const float r = color.r;
|
||||
const float g = color.g;
|
||||
@ -245,11 +245,11 @@ void Batch3D::blockCube(
|
||||
cube((1.0f - size) * -0.5f, size, texfaces, tint, shading);
|
||||
}
|
||||
|
||||
void Batch3D::point(glm::vec3 coord, glm::vec2 uv, glm::vec4 tint) {
|
||||
void Batch3D::point(const glm::vec3& coord, const glm::vec2& uv, const glm::vec4& tint) {
|
||||
vertex(coord, uv, tint.r, tint.g, tint.b, tint.a);
|
||||
}
|
||||
|
||||
void Batch3D::point(glm::vec3 coord, glm::vec4 tint) {
|
||||
void Batch3D::point(const glm::vec3& coord, const glm::vec4& tint) {
|
||||
point(coord, glm::vec2(), tint);
|
||||
}
|
||||
|
||||
|
||||
@ -27,12 +27,13 @@ class Batch3D : public Flushable {
|
||||
float r, float g, float b, float a
|
||||
);
|
||||
void vertex(
|
||||
glm::vec3 coord,
|
||||
const glm::vec3& coord,
|
||||
float u, float v,
|
||||
float r, float g, float b, float a
|
||||
);
|
||||
void vertex(
|
||||
glm::vec3 point, glm::vec2 uvpoint,
|
||||
const glm::vec3& point,
|
||||
const glm::vec2& uvpoint,
|
||||
float r, float g, float b, float a
|
||||
);
|
||||
void face(
|
||||
@ -49,12 +50,18 @@ public:
|
||||
|
||||
void begin();
|
||||
void texture(Texture* texture);
|
||||
void sprite(glm::vec3 pos, glm::vec3 up, glm::vec3 right, float w, float h, const UVRegion& uv, glm::vec4 tint);
|
||||
void sprite(
|
||||
const glm::vec3& pos,
|
||||
const glm::vec3& up,
|
||||
const glm::vec3& right, float w, float h, const UVRegion& uv,
|
||||
const glm::vec4& color
|
||||
);
|
||||
void xSprite(float w, float h, const UVRegion& uv, const glm::vec4 tint, bool shading=true);
|
||||
void cube(const glm::vec3 coords, const glm::vec3 size, const UVRegion(&texfaces)[6], const glm::vec4 tint, bool shading=true);
|
||||
void blockCube(const glm::vec3 size, const UVRegion(&texfaces)[6], const glm::vec4 tint, bool shading=true);
|
||||
void point(glm::vec3 pos, glm::vec2 uv, glm::vec4 tint);
|
||||
void point(glm::vec3 pos, glm::vec4 tint);
|
||||
void point(
|
||||
const glm::vec3& coord, const glm::vec2& uv, const glm::vec4& tint);
|
||||
void point(const glm::vec3& coord, const glm::vec4& tint);
|
||||
void flush() override;
|
||||
void flushPoints();
|
||||
};
|
||||
|
||||
@ -148,7 +148,7 @@ void DrawContext::setBlendMode(BlendMode mode) {
|
||||
set_blend_mode(mode);
|
||||
}
|
||||
|
||||
void DrawContext::setScissors(glm::vec4 area) {
|
||||
void DrawContext::setScissors(const glm::vec4& area) {
|
||||
Window::pushScissor(area);
|
||||
scissorsCount++;
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ public:
|
||||
void setDepthTest(bool flag);
|
||||
void setCullFace(bool flag);
|
||||
void setBlendMode(BlendMode mode);
|
||||
void setScissors(glm::vec4 area);
|
||||
void setScissors(const glm::vec4& area);
|
||||
void setLineWidth(float width);
|
||||
};
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ public:
|
||||
LineBatch(size_t capacity=4096);
|
||||
~LineBatch();
|
||||
|
||||
inline void line(const glm::vec3 a, const glm::vec3 b, const glm::vec4 color) {
|
||||
inline void line(const glm::vec3 &a, const glm::vec3 &b, const glm::vec4 &color) {
|
||||
line(a.x, a.y, a.z, b.x, b.y, b.z, color.r, color.g, color.b, color.a);
|
||||
}
|
||||
void line(float x1, float y1, float z1, float x2, float y2, float z2,
|
||||
@ -26,7 +26,7 @@ public:
|
||||
void box(float x, float y, float z, float w, float h, float d,
|
||||
float r, float g, float b, float a);
|
||||
|
||||
inline void box(glm::vec3 xyz, glm::vec3 whd, glm::vec4 rgba) {
|
||||
inline void box(const glm::vec3 &xyz, const glm::vec3 &whd, const glm::vec4 &rgba) {
|
||||
box(xyz.x, xyz.y, xyz.z, whd.x, whd.y, whd.z,
|
||||
rgba.r, rgba.g, rgba.b, rgba.a);
|
||||
}
|
||||
|
||||
@ -8,7 +8,11 @@ inline constexpr glm::vec3 X(1, 0, 0);
|
||||
inline constexpr glm::vec3 Y(0, 1, 0);
|
||||
inline constexpr glm::vec3 Z(0, 0, 1);
|
||||
|
||||
void Mesh::addPlane(glm::vec3 pos, glm::vec3 right, glm::vec3 up, glm::vec3 norm) {
|
||||
void Mesh::addPlane(
|
||||
const glm::vec3 &pos,
|
||||
const glm::vec3 &right,
|
||||
const glm::vec3 &up,
|
||||
const glm::vec3 &norm) {
|
||||
vertices.push_back({pos-right-up, {0,0}, norm});
|
||||
vertices.push_back({pos+right-up, {1,0}, norm});
|
||||
vertices.push_back({pos+right+up, {1,1}, norm});
|
||||
@ -18,7 +22,7 @@ void Mesh::addPlane(glm::vec3 pos, glm::vec3 right, glm::vec3 up, glm::vec3 norm
|
||||
vertices.push_back({pos-right+up, {0,1}, norm});
|
||||
}
|
||||
|
||||
void Mesh::addBox(glm::vec3 pos, glm::vec3 size) {
|
||||
void Mesh::addBox(const glm::vec3 &pos, const glm::vec3 &size) {
|
||||
addPlane(pos+Z*size, X*size, Y*size, Z);
|
||||
addPlane(pos-Z*size, -X*size, Y*size, -Z);
|
||||
|
||||
|
||||
@ -16,8 +16,12 @@ namespace model {
|
||||
std::string texture;
|
||||
std::vector<Vertex> vertices;
|
||||
|
||||
void addPlane(glm::vec3 pos, glm::vec3 right, glm::vec3 up, glm::vec3 norm);
|
||||
void addBox(glm::vec3 pos, glm::vec3 size);
|
||||
void addPlane(
|
||||
const glm::vec3& pos,
|
||||
const glm::vec3& right,
|
||||
const glm::vec3& up,
|
||||
const glm::vec3& norm);
|
||||
void addBox(const glm::vec3& pos, const glm::vec3& size);
|
||||
};
|
||||
|
||||
struct Model {
|
||||
|
||||
@ -54,11 +54,11 @@ void Shader::uniform2f(const std::string& name, float x, float y){
|
||||
glUniform2f(getUniformLocation(name), x, y);
|
||||
}
|
||||
|
||||
void Shader::uniform2f(const std::string& name, glm::vec2 xy){
|
||||
void Shader::uniform2f(const std::string& name, const glm::vec2& xy){
|
||||
glUniform2f(getUniformLocation(name), xy.x, xy.y);
|
||||
}
|
||||
|
||||
void Shader::uniform2i(const std::string& name, glm::ivec2 xy){
|
||||
void Shader::uniform2i(const std::string& name, const glm::ivec2& xy){
|
||||
glUniform2i(getUniformLocation(name), xy.x, xy.y);
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ void Shader::uniform3f(const std::string& name, float x, float y, float z){
|
||||
glUniform3f(getUniformLocation(name), x,y,z);
|
||||
}
|
||||
|
||||
void Shader::uniform3f(const std::string& name, glm::vec3 xyz){
|
||||
void Shader::uniform3f(const std::string& name, const glm::vec3& xyz){
|
||||
glUniform3f(getUniformLocation(name), xyz.x, xyz.y, xyz.z);
|
||||
}
|
||||
|
||||
|
||||
@ -26,10 +26,10 @@ public:
|
||||
void uniform1i(const std::string& name, int x);
|
||||
void uniform1f(const std::string& name, float x);
|
||||
void uniform2f(const std::string& name, float x, float y);
|
||||
void uniform2f(const std::string& name, glm::vec2 xy);
|
||||
void uniform2i(const std::string& name, glm::ivec2 xy);
|
||||
void uniform2f(const std::string& name, const glm::vec2& xy);
|
||||
void uniform2i(const std::string& name, const glm::ivec2& xy);
|
||||
void uniform3f(const std::string& name, float x, float y, float z);
|
||||
void uniform3f(const std::string& name, glm::vec3 xyz);
|
||||
void uniform3f(const std::string& name, const glm::vec3& xyz);
|
||||
|
||||
/// @brief Create shader program using vertex and fragment shaders source.
|
||||
/// @param vertexFile vertex shader file name
|
||||
|
||||
@ -35,7 +35,7 @@ struct DecomposedMat4 {
|
||||
glm::vec4 perspective;
|
||||
};
|
||||
|
||||
static glm::mat4 extract_rotation(glm::mat4 matrix) {
|
||||
static glm::mat4 extract_rotation(const glm::mat4& matrix) {
|
||||
DecomposedMat4 decomposed = {};
|
||||
glm::quat rotation;
|
||||
glm::decompose(
|
||||
@ -66,8 +66,10 @@ ModelBatch::ModelBatch(size_t capacity, Assets* assets, Chunks* chunks)
|
||||
|
||||
ModelBatch::~ModelBatch() = default;
|
||||
|
||||
void ModelBatch::draw(const model::Mesh& mesh, const glm::mat4& matrix,
|
||||
const glm::mat3& rotation, glm::vec3 tint,
|
||||
void ModelBatch::draw(const model::Mesh& mesh,
|
||||
const glm::mat4& matrix,
|
||||
const glm::mat3& rotation,
|
||||
const glm::vec3& tint,
|
||||
const texture_names_map* varTextures) {
|
||||
glm::vec3 gpos = matrix * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
light_t light = chunks->getLight(floor(gpos.x), floor(gpos.y), floor(gpos.z));
|
||||
@ -94,8 +96,9 @@ void ModelBatch::draw(const model::Mesh& mesh, const glm::mat4& matrix,
|
||||
}
|
||||
}
|
||||
|
||||
void ModelBatch::draw(glm::mat4 matrix,
|
||||
glm::vec3 tint,
|
||||
void ModelBatch::draw(
|
||||
const glm::mat4& matrix,
|
||||
const glm::vec3& tint,
|
||||
const model::Model* model,
|
||||
const texture_names_map* varTextures) {
|
||||
for (const auto& mesh : model->meshes) {
|
||||
|
||||
@ -37,7 +37,10 @@ class ModelBatch {
|
||||
static inline glm::vec3 SUN_VECTOR {0.411934f, 0.863868f, -0.279161f};
|
||||
|
||||
inline void vertex(
|
||||
glm::vec3 pos, glm::vec2 uv, glm::vec4 light, glm::vec3 tint
|
||||
const glm::vec3& pos,
|
||||
const glm::vec2& uv,
|
||||
const glm::vec4& light,
|
||||
const glm::vec3& tint
|
||||
) {
|
||||
float* buffer = this->buffer.get();
|
||||
buffer[index++] = pos.x;
|
||||
@ -64,8 +67,8 @@ class ModelBatch {
|
||||
|
||||
void draw(const model::Mesh& mesh,
|
||||
const glm::mat4& matrix,
|
||||
const glm::mat3& rotation,
|
||||
glm::vec3 tint,
|
||||
const glm::mat3& rotation,
|
||||
const glm::vec3& tint,
|
||||
const texture_names_map* varTextures);
|
||||
void setTexture(const std::string& name,
|
||||
const texture_names_map* varTextures);
|
||||
@ -84,8 +87,9 @@ public:
|
||||
ModelBatch(size_t capacity, Assets* assets, Chunks* chunks);
|
||||
~ModelBatch();
|
||||
|
||||
void draw(glm::mat4 matrix,
|
||||
glm::vec3 tint,
|
||||
void draw(
|
||||
const glm::mat4& matrix,
|
||||
const glm::vec3& tint,
|
||||
const model::Model* model,
|
||||
const texture_names_map* varTextures);
|
||||
void render();
|
||||
|
||||
@ -230,10 +230,12 @@ void WorldRenderer::renderBlockSelection() {
|
||||
: block->hitboxes;
|
||||
|
||||
lineBatch->lineWidth(2.0f);
|
||||
constexpr auto boxOffset = glm::vec3(0.02);
|
||||
constexpr auto boxColor = glm::vec4(0.f, 0.f, 0.f, 0.5f);
|
||||
for (auto& hitbox: hitboxes) {
|
||||
const glm::vec3 center = glm::vec3(pos) + hitbox.center();
|
||||
const glm::vec3 size = hitbox.size();
|
||||
lineBatch->box(center, size + glm::vec3(0.02), glm::vec4(0.f, 0.f, 0.f, 0.5f));
|
||||
lineBatch->box(center, size + boxOffset, boxColor);
|
||||
if (player->debug) {
|
||||
lineBatch->line(point, point+norm*0.5f, glm::vec4(1.0f, 0.0f, 1.0f, 1.0f));
|
||||
}
|
||||
@ -340,12 +342,12 @@ void WorldRenderer::draw(
|
||||
ctx.setDepthTest(true);
|
||||
ctx.setCullFace(true);
|
||||
renderLevel(ctx, camera, settings, delta, pause);
|
||||
// Debug lines
|
||||
|
||||
if (hudVisible){
|
||||
renderLines(camera, linesShader, ctx);
|
||||
}
|
||||
}
|
||||
|
||||
// Debug lines
|
||||
if (hudVisible && player->debug) {
|
||||
renderDebugLines(wctx, camera, linesShader);
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ InventoryBuilder::InventoryBuilder() {
|
||||
|
||||
void InventoryBuilder::addGrid(
|
||||
int cols, int count,
|
||||
glm::vec2 pos,
|
||||
const glm::vec2 &pos,
|
||||
int padding,
|
||||
bool addpanel,
|
||||
const SlotLayout& slotLayout
|
||||
@ -381,7 +381,7 @@ void InventoryView::setPos(glm::vec2 pos) {
|
||||
Container::setPos(pos - origin);
|
||||
}
|
||||
|
||||
void InventoryView::setOrigin(glm::vec2 origin) {
|
||||
void InventoryView::setOrigin(const glm::vec2 &origin) {
|
||||
this->origin = origin;
|
||||
}
|
||||
|
||||
|
||||
@ -93,7 +93,7 @@ namespace gui {
|
||||
|
||||
virtual void setPos(glm::vec2 pos) override;
|
||||
|
||||
void setOrigin(glm::vec2 origin);
|
||||
void setOrigin(const glm::vec2 &origin);
|
||||
glm::vec2 getOrigin() const;
|
||||
|
||||
void setSelected(int index);
|
||||
@ -130,7 +130,7 @@ namespace gui {
|
||||
/// @param slotLayout slot settings (index and position are ignored)
|
||||
void addGrid(
|
||||
int cols, int count,
|
||||
glm::vec2 pos,
|
||||
const glm::vec2 &pos,
|
||||
int padding,
|
||||
bool addpanel,
|
||||
const SlotLayout& slotLayout
|
||||
|
||||
@ -255,8 +255,8 @@ public:
|
||||
}
|
||||
|
||||
dynamic::Value applyRelative(
|
||||
Argument* arg,
|
||||
dynamic::Value value,
|
||||
Argument* arg,
|
||||
const dynamic::Value& value,
|
||||
const dynamic::Value& origin
|
||||
) {
|
||||
if (origin.index() == 0) {
|
||||
|
||||
@ -151,20 +151,20 @@ namespace lua {
|
||||
return 3;
|
||||
}
|
||||
|
||||
inline int pushivec3_stack(lua::State* L, glm::ivec3 vec) {
|
||||
inline int pushivec3_stack(lua::State* L, const glm::ivec3 &vec) {
|
||||
pushinteger(L, vec.x);
|
||||
pushinteger(L, vec.y);
|
||||
pushinteger(L, vec.z);
|
||||
return 3;
|
||||
}
|
||||
|
||||
inline int pushvec3_stack(lua::State* L, glm::vec3 vec) {
|
||||
inline int pushvec3_stack(lua::State* L, const glm::vec3 &vec) {
|
||||
pushnumber(L, vec.x);
|
||||
pushnumber(L, vec.y);
|
||||
pushnumber(L, vec.z);
|
||||
return 3;
|
||||
}
|
||||
inline int pushvec4_stack(lua::State* L, glm::vec4 vec) {
|
||||
inline int pushvec4_stack(lua::State* L, const glm::vec4 &vec) {
|
||||
pushnumber(L, vec.x);
|
||||
pushnumber(L, vec.y);
|
||||
pushnumber(L, vec.z);
|
||||
@ -179,15 +179,15 @@ namespace lua {
|
||||
lua_pushvalue(L, idx);
|
||||
return 1;
|
||||
}
|
||||
inline int pushvec2(lua::State* L, glm::vec2 vec) {
|
||||
inline int pushvec2(lua::State* L, const glm::vec2 &vec) {
|
||||
return pushvec(L, vec);
|
||||
}
|
||||
|
||||
inline int pushvec3(lua::State* L, glm::vec3 vec) {
|
||||
inline int pushvec3(lua::State* L, const glm::vec3 &vec) {
|
||||
return pushvec(L, vec);
|
||||
}
|
||||
|
||||
inline int pushvec4(lua::State* L, glm::vec4 vec) {
|
||||
inline int pushvec4(lua::State* L, const glm::vec4 &vec) {
|
||||
return pushvec(L, vec);
|
||||
}
|
||||
inline int pushcolor(lua::State* L, glm::vec4 vec) {
|
||||
@ -210,7 +210,7 @@ namespace lua {
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
inline int pushmat4(lua::State* L, glm::mat4 matrix) {
|
||||
inline int pushmat4(lua::State* L, const glm::mat4 &matrix) {
|
||||
createtable(L, 16, 0);
|
||||
for (uint y = 0; y < 4; y++) {
|
||||
for (uint x = 0; x < 4; x++) {
|
||||
@ -222,7 +222,7 @@ namespace lua {
|
||||
return 1;
|
||||
}
|
||||
/// @brief pushes matrix table to the stack and updates it with glm matrix
|
||||
inline int setmat4(lua::State* L, int idx, glm::mat4 matrix) {
|
||||
inline int setmat4(lua::State* L, int idx, const glm::mat4 &matrix) {
|
||||
pushvalue(L, idx);
|
||||
for (uint y = 0; y < 4; y++) {
|
||||
for (uint x = 0; x < 4; x++) {
|
||||
|
||||
@ -70,7 +70,7 @@ struct AABB {
|
||||
b = end;
|
||||
}
|
||||
|
||||
inline void addPoint(glm::vec3 p) {
|
||||
inline void addPoint(const glm::vec3& p) {
|
||||
a = glm::min(a, p);
|
||||
b = glm::max(b, p);
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ void Entities::loadEntity(const dynamic::Map_sptr& map) {
|
||||
spawn(def, {}, nullptr, map, uid);
|
||||
}
|
||||
|
||||
void Entities::loadEntity(const dynamic::Map_sptr& map, Entity entity) {
|
||||
void Entities::loadEntity(const dynamic::Map_sptr& map, const Entity &entity) {
|
||||
auto& transform = entity.getTransform();
|
||||
auto& body = entity.getRigidbody();
|
||||
auto& skeleton = entity.getSkeleton();
|
||||
@ -228,7 +228,7 @@ void Entities::loadEntity(const dynamic::Map_sptr& map, Entity entity) {
|
||||
}
|
||||
|
||||
std::optional<Entities::RaycastResult> Entities::rayCast(
|
||||
glm::vec3 start, glm::vec3 dir, float maxDistance, entityid_t ignore
|
||||
const glm::vec3 &start, const glm::vec3 &dir, float maxDistance, entityid_t ignore
|
||||
) {
|
||||
Ray ray(start, dir);
|
||||
auto view = registry.view<EntityId, Transform, Rigidbody>();
|
||||
@ -547,7 +547,7 @@ bool Entities::hasBlockingInside(AABB aabb) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<Entity> Entities::getAllInside(AABB aabb) {
|
||||
std::vector<Entity> Entities::getAllInside(const AABB &aabb) {
|
||||
std::vector<Entity> collected;
|
||||
auto view = registry.view<Transform>();
|
||||
for (auto [entity, transform] : view.each()) {
|
||||
@ -564,7 +564,7 @@ std::vector<Entity> Entities::getAllInside(AABB aabb) {
|
||||
return collected;
|
||||
}
|
||||
|
||||
std::vector<Entity> Entities::getAllInRadius(glm::vec3 center, float radius) {
|
||||
std::vector<Entity> Entities::getAllInRadius(const glm::vec3 ¢er, float radius) {
|
||||
std::vector<Entity> collected;
|
||||
auto view = registry.view<Transform>();
|
||||
for (auto [entity, transform] : view.each()) {
|
||||
|
||||
@ -49,19 +49,19 @@ struct Transform {
|
||||
|
||||
void refresh();
|
||||
|
||||
inline void setRot(glm::mat3 m) {
|
||||
inline void setRot(const glm::mat3 &m) {
|
||||
rot = m;
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
inline void setSize(glm::vec3 v) {
|
||||
inline void setSize(const glm::vec3 &v) {
|
||||
if (glm::distance2(displaySize, v) >= 0.00001f) {
|
||||
dirty = true;
|
||||
}
|
||||
size = v;
|
||||
}
|
||||
|
||||
inline void setPos(glm::vec3 v) {
|
||||
inline void setPos(const glm::vec3 &v) {
|
||||
if (glm::distance2(displayPos, v) >= 0.0001f) {
|
||||
dirty = true;
|
||||
}
|
||||
@ -212,15 +212,15 @@ public:
|
||||
/// @param ignore Ignored entity ID
|
||||
/// @return An optional structure containing entity, normal and distance
|
||||
std::optional<RaycastResult> rayCast(
|
||||
glm::vec3 start, glm::vec3 dir, float maxDistance, entityid_t ignore=-1);
|
||||
const glm::vec3 &start, const glm::vec3 &dir, float maxDistance, entityid_t ignore=-1);
|
||||
|
||||
void loadEntities(dynamic::Map_sptr map);
|
||||
void loadEntity(const dynamic::Map_sptr& map);
|
||||
void loadEntity(const dynamic::Map_sptr& map, Entity entity);
|
||||
void loadEntity(const dynamic::Map_sptr& map, const Entity &entity);
|
||||
void onSave(const Entity& entity);
|
||||
bool hasBlockingInside(AABB aabb);
|
||||
std::vector<Entity> getAllInside(AABB aabb);
|
||||
std::vector<Entity> getAllInRadius(glm::vec3 center, float radius);
|
||||
std::vector<Entity> getAllInside(const AABB &aabb);
|
||||
std::vector<Entity> getAllInRadius(const glm::vec3 ¢er, float radius);
|
||||
void despawn(entityid_t id);
|
||||
dynamic::Value serialize(const Entity& entity);
|
||||
|
||||
|
||||
@ -169,7 +169,7 @@ void Player::postUpdate() {
|
||||
glm::mat4(1.0f), glm::radians(cam.y), glm::vec3(1, 0, 0));
|
||||
}
|
||||
|
||||
void Player::teleport(glm::vec3 position) {
|
||||
void Player::teleport(const glm::vec3 &position) {
|
||||
this->position = position;
|
||||
if (auto hitbox = getHitbox()) {
|
||||
hitbox->position = position;
|
||||
@ -239,7 +239,7 @@ std::shared_ptr<Inventory> Player::getInventory() const {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
void Player::setSpawnPoint(glm::vec3 spawnpoint) {
|
||||
void Player::setSpawnPoint(const glm::vec3 &spawnpoint) {
|
||||
this->spawnpoint = spawnpoint;
|
||||
}
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ public:
|
||||
std::shared_ptr<Inventory> inv, entityid_t eid);
|
||||
~Player();
|
||||
|
||||
void teleport(glm::vec3 position);
|
||||
void teleport(const glm::vec3 &position);
|
||||
void updateEntity();
|
||||
void updateInput(PlayerInput& input, float delta);
|
||||
void updateSelectedEntity();
|
||||
@ -96,7 +96,7 @@ public:
|
||||
|
||||
Hitbox* getHitbox();
|
||||
|
||||
void setSpawnPoint(glm::vec3 point);
|
||||
void setSpawnPoint(const glm::vec3 &spawnpoint);
|
||||
glm::vec3 getSpawnPoint() const;
|
||||
|
||||
std::unique_ptr<dynamic::Map> serialize() const override;
|
||||
|
||||
@ -68,8 +68,8 @@ SkeletonConfig::SkeletonConfig(const std::string& name, std::unique_ptr<Bone> ro
|
||||
size_t SkeletonConfig::update(
|
||||
size_t index,
|
||||
Skeleton& skeleton,
|
||||
Bone* node,
|
||||
glm::mat4 matrix) const
|
||||
Bone* node,
|
||||
const glm::mat4& matrix) const
|
||||
{
|
||||
auto boneMatrix = skeleton.pose.matrices[index];
|
||||
auto boneOffset = node->getOffset();
|
||||
@ -85,7 +85,7 @@ size_t SkeletonConfig::update(
|
||||
return count;
|
||||
}
|
||||
|
||||
void SkeletonConfig::update(Skeleton& skeleton, glm::mat4 matrix) const {
|
||||
void SkeletonConfig::update(Skeleton& skeleton, const glm::mat4& matrix) const {
|
||||
update(0, skeleton, root.get(), matrix);
|
||||
}
|
||||
|
||||
|
||||
@ -103,12 +103,12 @@ namespace rigging {
|
||||
size_t index,
|
||||
Skeleton& skeleton,
|
||||
Bone* node,
|
||||
glm::mat4 matrix) const;
|
||||
const glm::mat4& matrix) const;
|
||||
public:
|
||||
SkeletonConfig(const std::string& name, std::unique_ptr<Bone> root,
|
||||
size_t nodesCount);
|
||||
|
||||
void update(Skeleton& skeleton, glm::mat4 matrix) const;
|
||||
void update(Skeleton& skeleton, const glm::mat4& matrix) const;
|
||||
void render(
|
||||
Assets* assets,
|
||||
ModelBatch& batch,
|
||||
|
||||
@ -37,7 +37,7 @@ std::string util::quote(const std::string& s) {
|
||||
return escape(s);
|
||||
}
|
||||
|
||||
std::wstring util::lfill(std::wstring s, uint length, wchar_t c) {
|
||||
std::wstring util::lfill(const std::wstring& s, uint length, wchar_t c) {
|
||||
if (s.length() >= length) {
|
||||
return s;
|
||||
}
|
||||
@ -49,7 +49,7 @@ std::wstring util::lfill(std::wstring s, uint length, wchar_t c) {
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
std::wstring util::rfill(std::wstring s, uint length, wchar_t c) {
|
||||
std::wstring util::rfill(const std::wstring& s, uint length, wchar_t c) {
|
||||
if (s.length() >= length) {
|
||||
return s;
|
||||
}
|
||||
|
||||
@ -13,8 +13,8 @@ namespace util {
|
||||
/// @brief Function used for error messages
|
||||
std::string quote(const std::string& s);
|
||||
|
||||
std::wstring lfill(std::wstring s, uint length, wchar_t c);
|
||||
std::wstring rfill(std::wstring s, uint length, wchar_t c);
|
||||
std::wstring lfill(const std::wstring& s, uint length, wchar_t c);
|
||||
std::wstring rfill(const std::wstring& s, uint length, wchar_t c);
|
||||
|
||||
uint encode_utf8(uint32_t c, ubyte* bytes);
|
||||
uint32_t decode_utf8(uint& size, const char* bytes);
|
||||
|
||||
@ -48,7 +48,7 @@ struct CoordSystem {
|
||||
|
||||
void transform(AABB& aabb) const;
|
||||
|
||||
inline bool isVectorHasNegatives(glm::ivec3 vec) {
|
||||
inline bool isVectorHasNegatives(const glm::ivec3& vec) {
|
||||
return (vec.x < 0 || vec.y < 0 || vec.z < 0);
|
||||
}
|
||||
};
|
||||
|
||||
@ -232,13 +232,13 @@ void Chunks::repairSegments(const Block* def, blockstate state, int x, int y, in
|
||||
}
|
||||
}
|
||||
|
||||
bool Chunks::checkReplaceability(const Block* def, blockstate state, glm::ivec3 origin, blockid_t ignore) {
|
||||
bool Chunks::checkReplaceability(const Block* def, blockstate state, const glm::ivec3 &coord, blockid_t ignore) {
|
||||
const auto& rotation = def->rotations.variants[state.rotation];
|
||||
const auto size = def->size;
|
||||
for (int sy = 0; sy < size.y; sy++) {
|
||||
for (int sz = 0; sz < size.z; sz++) {
|
||||
for (int sx = 0; sx < size.x; sx++) {
|
||||
auto pos = origin;
|
||||
auto pos = coord;
|
||||
pos += rotation.axisX * sx;
|
||||
pos += rotation.axisY * sy;
|
||||
pos += rotation.axisZ * sz;
|
||||
@ -257,7 +257,7 @@ bool Chunks::checkReplaceability(const Block* def, blockstate state, glm::ivec3
|
||||
}
|
||||
|
||||
void Chunks::setRotationExtended(
|
||||
Block* def, blockstate state, glm::ivec3 origin, uint8_t index
|
||||
Block* def, blockstate state, const glm::ivec3 &origin, uint8_t index
|
||||
) {
|
||||
auto newstate = state;
|
||||
newstate.rotation = index;
|
||||
@ -387,8 +387,8 @@ void Chunks::set(int32_t x, int32_t y, int32_t z, uint32_t id, blockstate state)
|
||||
}
|
||||
|
||||
voxel* Chunks::rayCast(
|
||||
glm::vec3 start,
|
||||
glm::vec3 dir,
|
||||
const glm::vec3 &start,
|
||||
const glm::vec3 &dir,
|
||||
float maxDist,
|
||||
glm::vec3& end,
|
||||
glm::ivec3& norm,
|
||||
@ -520,7 +520,7 @@ voxel* Chunks::rayCast(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
glm::vec3 Chunks::rayCastToObstacle(glm::vec3 start, glm::vec3 dir, float maxDist) {
|
||||
glm::vec3 Chunks::rayCastToObstacle(const glm::vec3 &start, const glm::vec3 &dir, float maxDist) {
|
||||
const float px = start.x;
|
||||
const float py = start.y;
|
||||
const float pz = start.z;
|
||||
|
||||
@ -27,7 +27,7 @@ class Chunks {
|
||||
|
||||
void eraseSegments(const Block* def, blockstate state, int x, int y, int z);
|
||||
void repairSegments(const Block* def, blockstate state, int x, int y, int z);
|
||||
void setRotationExtended(Block* def, blockstate state, glm::ivec3 origin, uint8_t rotation);
|
||||
void setRotationExtended(Block* def, blockstate state, const glm::ivec3 &origin, uint8_t rotation);
|
||||
public:
|
||||
std::vector<std::shared_ptr<Chunk>> chunks;
|
||||
std::vector<std::shared_ptr<Chunk>> chunksSecond;
|
||||
@ -48,7 +48,7 @@ public:
|
||||
Chunk* getChunkByVoxel(int32_t x, int32_t y, int32_t z);
|
||||
voxel* get(int32_t x, int32_t y, int32_t z) const;
|
||||
|
||||
inline voxel* get(glm::ivec3 pos) {
|
||||
inline voxel* get(const glm::ivec3 &pos) {
|
||||
return get(pos.x, pos.y, pos.z);
|
||||
}
|
||||
|
||||
@ -68,20 +68,20 @@ public:
|
||||
/// @param state the block state
|
||||
/// @param coord position of the zone start
|
||||
/// @param ignore ignored block id (will be counted as replaceable)
|
||||
bool checkReplaceability(const Block* def, blockstate state, glm::ivec3 coord, blockid_t ignore=0);
|
||||
bool checkReplaceability(const Block* def, blockstate state, const glm::ivec3 &coord, blockid_t ignore=0);
|
||||
|
||||
void setRotation(int32_t x, int32_t y, int32_t z, uint8_t rotation);
|
||||
|
||||
voxel* rayCast(
|
||||
glm::vec3 start,
|
||||
glm::vec3 dir,
|
||||
const glm::vec3 &start,
|
||||
const glm::vec3 &dir,
|
||||
float maxLength,
|
||||
glm::vec3& end,
|
||||
glm::ivec3& norm,
|
||||
glm::ivec3& iend
|
||||
);
|
||||
|
||||
glm::vec3 rayCastToObstacle(glm::vec3 start, glm::vec3 dir, float maxDist);
|
||||
glm::vec3 rayCastToObstacle(const glm::vec3 &start, const glm::vec3 &dir, float maxDist);
|
||||
|
||||
const AABB* isObstacleAt(float x, float y, float z);
|
||||
bool isSolidBlock(int32_t x, int32_t y, int32_t z);
|
||||
|
||||
@ -205,11 +205,11 @@ void Window::clearDepth() {
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
|
||||
void Window::setBgColor(glm::vec3 color) {
|
||||
void Window::setBgColor(const glm::vec3 &color) {
|
||||
glClearColor(color.r, color.g, color.b, 1.0f);
|
||||
}
|
||||
|
||||
void Window::setBgColor(glm::vec4 color) {
|
||||
void Window::setBgColor(const glm::vec4 &color) {
|
||||
glClearColor(color.r, color.g, color.b, color.a);
|
||||
}
|
||||
|
||||
|
||||
@ -49,8 +49,8 @@ public:
|
||||
|
||||
static void clear();
|
||||
static void clearDepth();
|
||||
static void setBgColor(glm::vec3 color);
|
||||
static void setBgColor(glm::vec4 color);
|
||||
static void setBgColor(const glm::vec3 &color);
|
||||
static void setBgColor(const glm::vec4 &color);
|
||||
static double time();
|
||||
static const char* getClipboardText();
|
||||
static void setClipboardText(const char* text);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user