mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-15 16:16:14 +00:00
Switched everything over from std::string to TString (farewell StringUtil!)
This commit is contained in:
@@ -53,7 +53,7 @@ bool CShader::CompileVertexSource(const char* kpSource)
|
||||
|
||||
if (CompileStatus == GL_FALSE)
|
||||
{
|
||||
std::string Out = "dump/BadVS_" + std::to_string(gFailedCompileCount) + ".txt";
|
||||
TString Out = "dump/BadVS_" + std::to_string(gFailedCompileCount) + ".txt";
|
||||
std::cout << "ERROR: Unable to compile vertex shader; dumped to " << Out << "\n";
|
||||
DumpShaderSource(mVertexShader, Out);
|
||||
|
||||
@@ -65,7 +65,7 @@ bool CShader::CompileVertexSource(const char* kpSource)
|
||||
// Debug dump
|
||||
else if (gDebugDumpShaders == true)
|
||||
{
|
||||
std::string Out = "dump/VS_" + std::to_string(gSuccessfulCompileCount) + ".txt";
|
||||
TString Out = "dump/VS_" + TString::FromInt64(gSuccessfulCompileCount, 8, 10) + ".txt";
|
||||
std::cout << "Debug shader dumping enabled; dumped to " << Out << "\n";
|
||||
DumpShaderSource(mVertexShader, Out);
|
||||
|
||||
@@ -88,7 +88,7 @@ bool CShader::CompilePixelSource(const char* kpSource)
|
||||
|
||||
if (CompileStatus == GL_FALSE)
|
||||
{
|
||||
std::string Out = "dump/BadPS_" + std::to_string(gFailedCompileCount) + ".txt";
|
||||
TString Out = "dump/BadPS_" + TString::FromInt64(gFailedCompileCount, 8, 10) + ".txt";
|
||||
std::cout << "ERROR: Unable to compile pixel shader; dumped to " << Out << "\n";
|
||||
DumpShaderSource(mPixelShader, Out);
|
||||
|
||||
@@ -100,7 +100,7 @@ bool CShader::CompilePixelSource(const char* kpSource)
|
||||
// Debug dump
|
||||
else if (gDebugDumpShaders == true)
|
||||
{
|
||||
std::string Out = "dump/PS_" + std::to_string(gSuccessfulCompileCount) + ".txt";
|
||||
TString Out = "dump/PS_" + TString::FromInt64(gSuccessfulCompileCount, 8, 10) + ".txt";
|
||||
std::cout << "Debug shader dumping enabled; dumped to " << Out << "\n";
|
||||
DumpShaderSource(mPixelShader, Out);
|
||||
|
||||
@@ -131,7 +131,7 @@ bool CShader::LinkShaders()
|
||||
|
||||
if (LinkStatus == GL_FALSE)
|
||||
{
|
||||
std::string Out = "dump/BadLink_" + std::to_string(gFailedCompileCount) + ".txt";
|
||||
TString Out = "dump/BadLink_" + TString::FromInt64(gFailedCompileCount, 8, 10) + ".txt";
|
||||
std::cout << "ERROR: Unable to link shaders. Dumped error log to " << Out << "\n";
|
||||
|
||||
GLint LogLen;
|
||||
@@ -140,7 +140,7 @@ bool CShader::LinkShaders()
|
||||
glGetProgramInfoLog(mProgram, LogLen, NULL, InfoLog);
|
||||
|
||||
std::ofstream LinkOut;
|
||||
LinkOut.open(Out.c_str());
|
||||
LinkOut.open(*Out);
|
||||
|
||||
if (LogLen > 0)
|
||||
LinkOut << InfoLog;
|
||||
@@ -197,12 +197,12 @@ void CShader::SetCurrent()
|
||||
}
|
||||
|
||||
// ************ STATIC ************
|
||||
CShader* CShader::FromResourceFile(std::string ShaderName)
|
||||
CShader* CShader::FromResourceFile(const TString& ShaderName)
|
||||
{
|
||||
std::string VertexShaderFilename = "../resources/shaders/" + ShaderName + ".vs";
|
||||
std::string PixelShaderFilename = "../resources/shaders/" + ShaderName + ".ps";
|
||||
CTextInStream VertexShaderFile(VertexShaderFilename);
|
||||
CTextInStream PixelShaderFile(PixelShaderFilename);
|
||||
TString VertexShaderFilename = "../resources/shaders/" + ShaderName + ".vs";
|
||||
TString PixelShaderFilename = "../resources/shaders/" + ShaderName + ".ps";
|
||||
CTextInStream VertexShaderFile(VertexShaderFilename.ToStdString());
|
||||
CTextInStream PixelShaderFile(PixelShaderFilename.ToStdString());
|
||||
|
||||
if (!VertexShaderFile.IsValid())
|
||||
std::cout << "Error: Couldn't load vertex shader file for " << ShaderName << "\n";
|
||||
@@ -236,7 +236,7 @@ void CShader::KillCachedShader()
|
||||
}
|
||||
|
||||
// ************ PRIVATE ************
|
||||
void CShader::DumpShaderSource(GLuint Shader, std::string Out)
|
||||
void CShader::DumpShaderSource(GLuint Shader, const TString& Out)
|
||||
{
|
||||
GLint SourceLen;
|
||||
glGetShaderiv(Shader, GL_SHADER_SOURCE_LENGTH, &SourceLen);
|
||||
@@ -249,7 +249,7 @@ void CShader::DumpShaderSource(GLuint Shader, std::string Out)
|
||||
glGetShaderInfoLog(Shader, LogLen, NULL, InfoLog);
|
||||
|
||||
std::ofstream ShaderOut;
|
||||
ShaderOut.open(Out.c_str());
|
||||
ShaderOut.open(*Out);
|
||||
|
||||
if (SourceLen > 0)
|
||||
ShaderOut << Source;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define CSHADER_H
|
||||
|
||||
#include <gl/glew.h>
|
||||
#include <string>
|
||||
#include <Common/TString.h>
|
||||
|
||||
class CShader
|
||||
{
|
||||
@@ -29,17 +29,17 @@ public:
|
||||
bool LinkShaders();
|
||||
bool IsValidProgram();
|
||||
GLuint GetProgramID();
|
||||
GLuint GetUniformLocation(const char* Uniform);
|
||||
GLuint GetUniformBlockIndex(const char* UniformBlock);
|
||||
GLuint GetUniformLocation(const char* kpUniform);
|
||||
GLuint GetUniformBlockIndex(const char* kpUniformBlock);
|
||||
void SetCurrent();
|
||||
|
||||
// Static
|
||||
static CShader* FromResourceFile(std::string ShaderName);
|
||||
static CShader* FromResourceFile(const TString& ShaderName);
|
||||
static CShader* CurrentShader();
|
||||
static void KillCachedShader();
|
||||
|
||||
private:
|
||||
void DumpShaderSource(GLuint Shader, std::string Out);
|
||||
void DumpShaderSource(GLuint Shader, const TString& Out);
|
||||
};
|
||||
|
||||
#endif // CSHADER_H
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <gl/glew.h>
|
||||
#include "CShaderGenerator.h"
|
||||
|
||||
const std::string gkCoordSrc[] = {
|
||||
const TString gkCoordSrc[] = {
|
||||
"RawPosition.xyz",
|
||||
"RawNormal.xyz",
|
||||
"0.0, 0.0, 0.0",
|
||||
@@ -19,7 +19,7 @@ const std::string gkCoordSrc[] = {
|
||||
"RawTex7.xy, 1.0"
|
||||
};
|
||||
|
||||
const std::string gkRasSel[] = {
|
||||
const TString gkRasSel[] = {
|
||||
"vec4(COLOR0A0.rgb, 1.0)",
|
||||
"vec4(COLOR1A1.rgb, 1.0)",
|
||||
"vec4(0.0, 0.0, 0.0, COLOR0A0.a)",
|
||||
@@ -29,7 +29,7 @@ const std::string gkRasSel[] = {
|
||||
"vec4(0.0, 0.0, 0.0, 0.0)"
|
||||
};
|
||||
|
||||
const std::string gkKonstColor[] = {
|
||||
const TString gkKonstColor[] = {
|
||||
"1.0, 1.0, 1.0",
|
||||
"0.875, 0.875, 0.875",
|
||||
"0.75, 0.75, 0.75",
|
||||
@@ -64,7 +64,7 @@ const std::string gkKonstColor[] = {
|
||||
"KonstColors[3].aaa"
|
||||
};
|
||||
|
||||
const std::string gkKonstAlpha[] = {
|
||||
const TString gkKonstAlpha[] = {
|
||||
"1.0",
|
||||
"0.875",
|
||||
"0.75",
|
||||
@@ -99,7 +99,7 @@ const std::string gkKonstAlpha[] = {
|
||||
"KonstColors[3].a"
|
||||
};
|
||||
|
||||
const std::string gkTevColor[] = {
|
||||
const TString gkTevColor[] = {
|
||||
"Prev.rgb",
|
||||
"Prev.aaa",
|
||||
"C0.rgb",
|
||||
@@ -118,7 +118,7 @@ const std::string gkTevColor[] = {
|
||||
"0.0, 0.0, 0.0"
|
||||
};
|
||||
|
||||
const std::string gkTevAlpha[] = {
|
||||
const TString gkTevAlpha[] = {
|
||||
"Prev.a",
|
||||
"C0.a",
|
||||
"C1.a",
|
||||
@@ -129,7 +129,7 @@ const std::string gkTevAlpha[] = {
|
||||
"0.0"
|
||||
};
|
||||
|
||||
const std::string gkTevRigid[] = {
|
||||
const TString gkTevRigid[] = {
|
||||
"Prev",
|
||||
"C0",
|
||||
"C1",
|
||||
|
||||
Reference in New Issue
Block a user