RIP tp::Strings

This commit is contained in:
IlyaShurupov 2024-03-22 14:44:26 +03:00 committed by Ilya Shurupov
parent fa2d0aaa92
commit 1756ca026d
90 changed files with 419 additions and 1475 deletions

View file

@ -1,6 +1,5 @@
#include "Strings.hpp"
#include "Buffer.hpp"
#include "LocalConnection.hpp"
#include "Shader.hpp"
@ -96,7 +95,7 @@ void RenderShader::load(const char* pvert, const char* pgeom, const char* pfrag,
if (paths) {
String content;
std::string content;
auto loadFile = [&](const char* path) {
LocalConnection file;
@ -105,26 +104,30 @@ void RenderShader::load(const char* pvert, const char* pgeom, const char* pfrag,
return false;
}
content.resize(file.size());
file.readBytes(content.write(), content.size());
const auto size = file.size();
auto tmp = new char[size + 1];
tmp[size] = 0;
file.readBytes(tmp, size);
content = tmp;
delete[] tmp;
return true;
};
printf("Compiling shader : %s\n", pvert);
if (loadFile(pvert)) {
compile_shader(content.read(), VertexShaderID);
compile_shader(content.c_str(), VertexShaderID);
}
if (GeometryShaderID) {
printf("Compiling shader : %s\n", pgeom);
if (loadFile(pgeom)) {
compile_shader(content.read(), GeometryShaderID);
compile_shader(content.c_str(), GeometryShaderID);
}
}
printf("Compiling shader : %s\n", pfrag);
if (loadFile(pfrag)) {
compile_shader(content.read(), FragmentShaderID);
compile_shader(content.c_str(), FragmentShaderID);
}
}
else {

View file

@ -3,8 +3,6 @@
#include "Map.hpp"
#include "Strings.hpp"
#include "Shader.hpp"
#include "GraphicsApi.hpp"
@ -71,7 +69,7 @@ void RenderTexture::draw(const GLuint& out) {
struct texture_drawer_data {
Map<String, GLuint> textures;
Map<std::string, GLuint> textures;
GLuint quad_VertexArrayID;
GLuint quad_vertexbuffer;
@ -147,7 +145,7 @@ void RenderTexture::draw_texture(uint4 out, uint4 in) {
texdd->shader.unbind();
}
GLuint load_texture(const String& name) {
GLuint load_texture(const std::string& name) {
GLuint tex_2d = 0;
ASSERT(0 && "incomplete compilation - no SOIL support added");