加入 Node节点类 还未测试新框架
This commit is contained in:
@@ -28,7 +28,7 @@ RenderManager::RenderManager(SDL_Window *window)
|
||||
_windowHeight = height;
|
||||
|
||||
// 游戏的初始正交投影矩阵
|
||||
_GameOrthoMatrix = glm::ortho(0.0f, (float)width / 1.2f, (float)height / 1.2f, 0.0f, -1.0f, 1.0f);
|
||||
_GameOrthoMatrix = glm::ortho(0.0f, (float)width, (float)height, 0.0f, -1.0f, 1.0f);
|
||||
// UI的初始正交投影矩阵
|
||||
_UIOrthoMatrix = glm::ortho(0.0f, (float)width, (float)height, 0.0f, -1.0f, 1.0f);
|
||||
|
||||
@@ -36,6 +36,7 @@ RenderManager::RenderManager(SDL_Window *window)
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
// 启用混合模式
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
// 默认设置标准alpha混合
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
@@ -228,8 +229,8 @@ void RenderManager::Init2DTextureProgram()
|
||||
glUniform1i(_currentRenderParams.UnimLocs[2], 0);
|
||||
|
||||
// 处理纹理裁剪
|
||||
int texWidth = textureObj->getSize().width;
|
||||
int texHeight = textureObj->getSize().height;
|
||||
float texWidth = (float)textureObj->getSize().width;
|
||||
float texHeight = (float)textureObj->getSize().height;
|
||||
|
||||
// 计算纹理坐标
|
||||
float minu, minv, maxu, maxv;
|
||||
@@ -336,6 +337,16 @@ void RenderManager::SetOrthoMatrixType(int type)
|
||||
_OrthoMatrix = _UIOrthoMatrix;
|
||||
}
|
||||
|
||||
glm::mat4 RenderManager::GetOrthoMatrix()
|
||||
{
|
||||
return _OrthoMatrix;
|
||||
}
|
||||
|
||||
void RenderManager::SetOrthoMatrix(glm::mat4 matrix)
|
||||
{
|
||||
_OrthoMatrix = matrix;
|
||||
}
|
||||
|
||||
GLuint RenderManager::CompileShader(GLenum type, std::string Path)
|
||||
{
|
||||
std::ifstream Source("shader/" + Path);
|
||||
|
||||
Reference in New Issue
Block a user