mirror of
https://github.com/edubart/otclient.git
synced 2025-10-19 14:03:26 +02:00
doc and luabinder changes
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "bitmapfont.h"
|
||||
|
||||
//@bindsingleton g_fonts
|
||||
class FontManager
|
||||
{
|
||||
public:
|
||||
|
@@ -82,7 +82,7 @@ void Graphics::init()
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
// determine max texture size
|
||||
GLint maxTextureSize = 0;
|
||||
int maxTextureSize = 0;
|
||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
|
||||
if(m_maxTextureSize == -1 || m_maxTextureSize > maxTextureSize)
|
||||
m_maxTextureSize = maxTextureSize;
|
||||
|
@@ -26,6 +26,7 @@
|
||||
#include "declarations.h"
|
||||
#include "painter.h"
|
||||
|
||||
// @bindsingleton g_graphics
|
||||
class Graphics
|
||||
{
|
||||
public:
|
||||
@@ -37,8 +38,11 @@ public:
|
||||
Painter_OpenGL2
|
||||
};
|
||||
|
||||
// @dontbind
|
||||
void init();
|
||||
// @dontbind
|
||||
void terminate();
|
||||
|
||||
bool parseOption(const std::string& option);
|
||||
|
||||
bool isPainterEngineAvailable(PainterEngine painterEngine);
|
||||
@@ -47,8 +51,6 @@ public:
|
||||
|
||||
void resize(const Size& size);
|
||||
|
||||
void setViewportSize(const Size& size);
|
||||
|
||||
int getMaxTextureSize() { return m_maxTextureSize; }
|
||||
const Size& getViewportSize() { return m_viewportSize; }
|
||||
|
||||
|
@@ -49,7 +49,7 @@ public:
|
||||
|
||||
private:
|
||||
Type m_type;
|
||||
GLuint m_id;
|
||||
uint m_id;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -135,7 +135,7 @@ void Painter::setTexture(Texture* texture)
|
||||
|
||||
m_texture = texture;
|
||||
|
||||
GLuint glTextureId;
|
||||
uint glTextureId;
|
||||
if(texture) {
|
||||
setTextureMatrix(texture->getTransformMatrix());
|
||||
glTextureId = texture->getId();
|
||||
|
@@ -137,7 +137,7 @@ protected:
|
||||
PainterState m_olderStates[10];
|
||||
int m_oldStateIndex;
|
||||
|
||||
GLuint m_glTextureId;
|
||||
uint m_glTextureId;
|
||||
};
|
||||
|
||||
extern Painter *g_painter;
|
||||
|
@@ -89,7 +89,7 @@ bool Shader::compileSourceFile(const std::string& sourceFile)
|
||||
std::string Shader::log()
|
||||
{
|
||||
std::string infoLog;
|
||||
GLint infoLogLength = 0;
|
||||
int infoLogLength = 0;
|
||||
glGetShaderiv(m_shaderId, GL_INFO_LOG_LENGTH, &infoLogLength);
|
||||
if(infoLogLength > 1) {
|
||||
std::vector<char> buf(infoLogLength);
|
||||
|
@@ -40,11 +40,11 @@ public:
|
||||
bool compileSourceFile(const std::string& sourceFile);
|
||||
std::string log();
|
||||
|
||||
GLuint getShaderId() { return m_shaderId; }
|
||||
uint getShaderId() { return m_shaderId; }
|
||||
ShaderType getShaderType() { return m_shaderType; }
|
||||
|
||||
private:
|
||||
GLuint m_shaderId;
|
||||
uint m_shaderId;
|
||||
ShaderType m_shaderType;
|
||||
};
|
||||
|
||||
|
@@ -25,7 +25,7 @@
|
||||
|
||||
#include <framework/application.h>
|
||||
|
||||
GLuint ShaderProgram::m_currentProgram = 0;
|
||||
uint ShaderProgram::m_currentProgram = 0;
|
||||
|
||||
ShaderProgram::ShaderProgram()
|
||||
{
|
||||
@@ -92,7 +92,7 @@ bool ShaderProgram::link()
|
||||
|
||||
glLinkProgram(m_programId);
|
||||
|
||||
GLint value = GL_FALSE;
|
||||
int value = GL_FALSE;
|
||||
glGetProgramiv(m_programId, GL_LINK_STATUS, &value);
|
||||
m_linked = (value != GL_FALSE);
|
||||
|
||||
@@ -123,7 +123,7 @@ void ShaderProgram::release()
|
||||
std::string ShaderProgram::log()
|
||||
{
|
||||
std::string infoLog;
|
||||
GLint infoLogLength = 0;
|
||||
int infoLogLength = 0;
|
||||
glGetProgramiv(m_programId, GL_INFO_LOG_LENGTH, &infoLogLength);
|
||||
if(infoLogLength > 1) {
|
||||
std::vector<char> buf(infoLogLength);
|
||||
|
@@ -26,6 +26,7 @@
|
||||
#include "shader.h"
|
||||
#include <framework/luascript/luaobject.h>
|
||||
|
||||
// @bindclass
|
||||
class ShaderProgram : public LuaObject
|
||||
{
|
||||
enum {
|
||||
@@ -65,7 +66,7 @@ public:
|
||||
void setAttributeValue(const char *name, float x, float y, float z) { glVertexAttrib3f(getAttributeLocation(name), x, y, z); }
|
||||
|
||||
void setUniformValue(int location, const Color& color) { glUniform4f(m_uniformLocations[location], color.rF(), color.gF(), color.bF(), color.aF()); }
|
||||
void setUniformValue(int location, GLint value) { glUniform1i(m_uniformLocations[location], value); }
|
||||
void setUniformValue(int location, int value) { glUniform1i(m_uniformLocations[location], value); }
|
||||
void setUniformValue(int location, float value) { glUniform1f(m_uniformLocations[location], value); }
|
||||
void setUniformValue(int location, float x, float y) { glUniform2f(m_uniformLocations[location], x, y); }
|
||||
void setUniformValue(int location, float x, float y, float z) { glUniform3f(m_uniformLocations[location], x, y, z); }
|
||||
@@ -73,25 +74,25 @@ public:
|
||||
void setUniformValue(int location, const Matrix2& mat) { glUniformMatrix2fv(m_uniformLocations[location], 1, GL_FALSE, mat.data()); }
|
||||
void setUniformValue(int location, const Matrix3& mat) { glUniformMatrix3fv(m_uniformLocations[location], 1, GL_FALSE, mat.data()); }
|
||||
void setUniformValue(const char *name, const Color& color) { glUniform4f(glGetUniformLocation(m_programId, name), color.rF(), color.gF(), color.bF(), color.aF()); }
|
||||
void setUniformValue(const char *name, GLint value) { glUniform1i(glGetUniformLocation(m_programId, name), value); }
|
||||
void setUniformValue(const char *name, int value) { glUniform1i(glGetUniformLocation(m_programId, name), value); }
|
||||
void setUniformValue(const char *name, float value) { glUniform1f(glGetUniformLocation(m_programId, name), value); }
|
||||
void setUniformValue(const char *name, float x, float y) { glUniform2f(glGetUniformLocation(m_programId, name), x, y); }
|
||||
void setUniformValue(const char *name, float x, float y, float z) { glUniform3f(glGetUniformLocation(m_programId, name), x, y, z); }
|
||||
void setUniformValue(const char *name, float x, float y, float z, float w) { glUniform4f(glGetUniformLocation(m_programId, name), x, y, z, w); }
|
||||
void setUniformValue(const char *name, const Matrix2& mat) { glUniformMatrix2fv(glGetUniformLocation(m_programId, name), 1, GL_FALSE, mat.data()); }
|
||||
void setUniformValue(const char *name, const Matrix3& mat) { glUniformMatrix3fv(glGetUniformLocation(m_programId, name), 1, GL_FALSE, mat.data()); }
|
||||
// TODO: Point, PointF, Color, Size, SizeF ?
|
||||
|
||||
// Point, PointF, Color, Size, SizeF,
|
||||
bool isLinked() { return m_linked; }
|
||||
GLuint getProgramId() { return m_programId; }
|
||||
uint getProgramId() { return m_programId; }
|
||||
ShaderList getShaders() { return m_shaders; }
|
||||
|
||||
private:
|
||||
bool m_linked;
|
||||
GLuint m_programId;
|
||||
static GLuint m_currentProgram;
|
||||
uint m_programId;
|
||||
static uint m_currentProgram;
|
||||
ShaderList m_shaders;
|
||||
std::array<GLint, MAX_UNIFORM_LOCATIONS> m_uniformLocations;
|
||||
std::array<int, MAX_UNIFORM_LOCATIONS> m_uniformLocations;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -176,7 +176,7 @@ bool Texture::setupSize(const Size& size, bool forcePowerOfTwo)
|
||||
|
||||
void Texture::setupWrap()
|
||||
{
|
||||
GLint texParam;
|
||||
int texParam;
|
||||
if(!m_repeat && g_graphics.canUseClampToEdge())
|
||||
texParam = GL_CLAMP_TO_EDGE;
|
||||
else
|
||||
@@ -188,8 +188,8 @@ void Texture::setupWrap()
|
||||
|
||||
void Texture::setupFilters()
|
||||
{
|
||||
GLint minFilter;
|
||||
GLint magFilter;
|
||||
int minFilter;
|
||||
int magFilter;
|
||||
if(m_smooth) {
|
||||
minFilter = m_hasMipmaps ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR;
|
||||
magFilter = GL_LINEAR;
|
||||
|
@@ -41,7 +41,7 @@ public:
|
||||
void setRepeat(bool repeat);
|
||||
void setUpsideDown(bool upsideDown);
|
||||
|
||||
GLuint getId() { return m_id; }
|
||||
uint getId() { return m_id; }
|
||||
int getWidth() { return m_size.width(); }
|
||||
int getHeight() { return m_size.height(); }
|
||||
const Size& getSize() { return m_size; }
|
||||
@@ -59,7 +59,7 @@ protected:
|
||||
void setupTranformMatrix();
|
||||
void setupPixels(int level, const Size& size, uchar *pixels, int channels = 4);
|
||||
|
||||
GLuint m_id;
|
||||
uint m_id;
|
||||
Size m_size;
|
||||
Size m_glSize;
|
||||
Matrix3 m_transformMatrix;
|
||||
|
Reference in New Issue
Block a user