Minor formating fixes.
This commit is contained in:
parent
6f53b0c069
commit
4df668e68f
76 changed files with 121 additions and 121 deletions
|
|
@ -220,7 +220,7 @@ unsigned int BatchRenderer2D::addRenderable(Vertex2D* buffer, const Renderable2D
|
|||
const Transform& transform = renderable->getTransform();
|
||||
const std::vector<Vertex2D>& vertices = renderable->getVertices();
|
||||
|
||||
// Pretransform vertex positions to skip setting a uniform model
|
||||
// Pretransform vertex positions to skip setting a uniform model
|
||||
// matrix in the shader for each renderable reducing the number of draw calls.
|
||||
|
||||
for(size_t i = 0; i < vertices.size(); i++) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
namespace sp {
|
||||
|
||||
DefaultRenderer2D::DefaultRenderer2D()
|
||||
DefaultRenderer2D::DefaultRenderer2D()
|
||||
{
|
||||
m_shader.create();
|
||||
if (!m_shader.loadFromFile("assets/shaders/standard.shader.glsl")) {
|
||||
|
|
@ -73,4 +73,4 @@ void DefaultRenderer2D::render()
|
|||
m_queue.clear();
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ Vector2u Font::findTextureRegion(const Image& img) const
|
|||
resizeTexture();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pos = m_cacheTextureA.texpos;
|
||||
|
||||
m_cacheTextureA.texpos.x += img.getWidth() + 1;
|
||||
|
|
@ -127,4 +127,4 @@ const Texture* Font::getTexture() const
|
|||
return &m_cacheTextureA.texture;
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -13,4 +13,4 @@ void FontDriver::setHinting(bool value)
|
|||
m_hinting = value;
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -80,14 +80,14 @@ bool FreeTypeDriver::setCharacterSize(unsigned int size)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool FreeTypeDriver::loadFromFile(const std::string& filename)
|
||||
bool FreeTypeDriver::loadFromFile(const std::string& filename)
|
||||
{
|
||||
FT_Face face;
|
||||
FT_Error error;
|
||||
|
||||
error = FT_New_Face(LibWrapper::getInstance().handle, filename.c_str(), 0, &face);
|
||||
if (error) {
|
||||
Log::warn("FreeType: could not load file (%s): %s",
|
||||
Log::warn("FreeType: could not load file (%s): %s",
|
||||
filename.c_str(), FT_GetErrorString(error));
|
||||
return false;
|
||||
}
|
||||
|
|
@ -168,4 +168,4 @@ std::string FreeTypeDriver::getName()
|
|||
return m_face->family_name;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
const struct error_list {
|
||||
int code;
|
||||
const char* msg;
|
||||
} ft_errors[] =
|
||||
} ft_errors[] =
|
||||
#include FT_ERRORS_H
|
||||
|
||||
const char* FT_GetErrorString(FT_Error error) {
|
||||
|
|
|
|||
|
|
@ -7,4 +7,4 @@
|
|||
|
||||
const char* FT_GetErrorString(FT_Error error);
|
||||
|
||||
#endif /* SPECTRE_GRAPHICS_FONT_FREETYPE_ERROR_H */
|
||||
#endif /* SPECTRE_GRAPHICS_FONT_FREETYPE_ERROR_H */
|
||||
|
|
|
|||
|
|
@ -9,4 +9,4 @@ void glCheckError(const char *file, unsigned int line, const char *expr) {
|
|||
if (err != GL_NO_ERROR) {
|
||||
std::string msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
#include <Spectre/Graphics/OpenGL.h>
|
||||
|
||||
#define checkGLError(expr) do { expr; glCheckError(__FILE__, __LINE__, #expr); } while(false)
|
||||
#define checkGLError(expr) do { expr; glCheckError(__FILE__, __LINE__, #expr); } while(false)
|
||||
|
||||
void glCheckError(const char *file, unsigned int line, const char *expr);
|
||||
|
||||
#endif /* SPECTRE_GRAPHICS_GL_CHECKERROR_H */
|
||||
#endif /* SPECTRE_GRAPHICS_GL_CHECKERROR_H */
|
||||
|
|
|
|||
|
|
@ -210,4 +210,4 @@ const unsigned char* Image::getPixels() const
|
|||
return NULL;
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -90,4 +90,4 @@ void Graphics::swapBuffers()
|
|||
m_display->swapBuffers();
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ void RenderState::enableTexture(const Texture *texture)
|
|||
// Enable the new texture.
|
||||
if (texture) {
|
||||
texture->enable();
|
||||
}
|
||||
}
|
||||
// No texture selected.
|
||||
// Must unbind cached texture if set.
|
||||
else if (m_texture) {
|
||||
|
|
@ -49,4 +49,4 @@ void RenderState::cleanup()
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ m_zorder (0)
|
|||
{
|
||||
}
|
||||
|
||||
Renderable2D::Renderable2D(const Vector2f& position) :
|
||||
Renderable2D::Renderable2D(const Vector2f& position) :
|
||||
m_zorder (0),
|
||||
Transformable (position)
|
||||
{
|
||||
|
|
@ -28,4 +28,4 @@ void Renderable2D::setZOrder(unsigned char value)
|
|||
m_zorder = value;
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -16,4 +16,4 @@ void Renderer2D::setCamera(const Camera2D& camera)
|
|||
m_camera = &camera;
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -101,4 +101,4 @@ std::string Shader::fetchErrorLog()
|
|||
return std::string(buf);
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ bool ShaderProgram::loadFromFile(const std::string& filename)
|
|||
std::string base_name = filename.substr(0, filename.length() - extension.length());
|
||||
|
||||
// vert and frag are not optional. they must exist.
|
||||
return loadFromFile(base_name + "vert.glsl", Shader::Type::Vertex) &&
|
||||
return loadFromFile(base_name + "vert.glsl", Shader::Type::Vertex) &&
|
||||
loadFromFile(base_name + "frag.glsl", Shader::Type::Fragment);
|
||||
|
||||
} else if (extension == "vert.glsl") {
|
||||
|
|
@ -117,7 +117,7 @@ void ShaderProgram::enable() const
|
|||
{
|
||||
glUseProgram(m_id);
|
||||
}
|
||||
|
||||
|
||||
void ShaderProgram::disable() const
|
||||
{
|
||||
glUseProgram(0);
|
||||
|
|
@ -194,4 +194,4 @@ std::string ShaderProgram::fetchErrorLog()
|
|||
return std::string(buf);
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ void Sprite::setTextureCoords(const vec2u& pos, const vec2u& size)
|
|||
float left = pos.x / tex_size.x;
|
||||
float right = left + (size.x / tex_size.x);
|
||||
float top = pos.y / tex_size.y;
|
||||
float bottom = top + (size.y / tex_size.y);
|
||||
float bottom = top + (size.y / tex_size.y);
|
||||
|
||||
m_vertices[0].uv = Vector2f(left , top);
|
||||
m_vertices[1].uv = Vector2f(left , bottom);
|
||||
|
|
@ -118,4 +118,4 @@ void Sprite::render(Renderer2D& renderer) const
|
|||
renderer.draw(this);
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -177,4 +177,4 @@ void Text::render(Renderer2D& renderer) const
|
|||
renderer.draw(this);
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -60,8 +60,8 @@ void Texture::create(unsigned width, unsigned heigth, PixelFormat format)
|
|||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
}
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D, 0,
|
||||
pixelFormatToInternal(format), width, heigth, 0,
|
||||
glTexImage2D(GL_TEXTURE_2D, 0,
|
||||
pixelFormatToInternal(format), width, heigth, 0,
|
||||
pixelFormatToGL(format), GL_UNSIGNED_BYTE, &empty_pixels[0]);
|
||||
|
||||
setSmooth(true);
|
||||
|
|
@ -98,7 +98,7 @@ void Texture::create(const Image& image)
|
|||
srcFormat = pixelFormatToGL(image.getFormat());
|
||||
glFormat = pixelFormatToInternal(image.getFormat());
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, glFormat, m_size.x, m_size.y,
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, glFormat, m_size.x, m_size.y,
|
||||
0, srcFormat, GL_UNSIGNED_BYTE, image.getPixels());
|
||||
|
||||
setSmooth(true);
|
||||
|
|
@ -157,8 +157,8 @@ void Texture::update(vec2u pos, const Image& image)
|
|||
|
||||
format = pixelFormatToGL(image.getFormat());
|
||||
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, pos.x, pos.y,
|
||||
image.getWidth(), image.getHeight(),
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, pos.x, pos.y,
|
||||
image.getWidth(), image.getHeight(),
|
||||
format, GL_UNSIGNED_BYTE, image.getPixels());
|
||||
|
||||
disable();
|
||||
|
|
@ -180,9 +180,9 @@ Image Texture::copyToImage() const
|
|||
|
||||
//glPixelStorei(GL_PACK_ALIGNMENT, 4);
|
||||
|
||||
glGetTexImage(GL_TEXTURE_2D, 0,
|
||||
pixelFormatToGL(m_format),
|
||||
GL_UNSIGNED_BYTE,
|
||||
glGetTexImage(GL_TEXTURE_2D, 0,
|
||||
pixelFormatToGL(m_format),
|
||||
GL_UNSIGNED_BYTE,
|
||||
&pixels[0]);
|
||||
|
||||
img.create(m_format, m_size.x, m_size.y, &pixels[0]);
|
||||
|
|
@ -255,4 +255,4 @@ bool Texture::operator!=(const Texture* other) const
|
|||
return m_id != other->m_id;
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -96,4 +96,4 @@ const Transform& Transformable::getTransform() const
|
|||
return m_transform;
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
} // namespace sp
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue