Full transparency support is now added

This commit is contained in:
mathusummut
2018-06-21 19:57:44 +02:00
parent 3e8f8f7dd5
commit c15488a212
45 changed files with 299 additions and 1225 deletions

View File

@@ -41,7 +41,7 @@ namespace Shared {
virtual ~TextRenderer2DGl();
virtual void begin(Font2D *font);
virtual void render(const string &text, float x, float y, bool centered = false, Vec3f *color = NULL);
virtual void render(const string &text, float x, float y, bool centered = false, Vec4f *color = NULL);
virtual void end();
};
@@ -55,7 +55,7 @@ namespace Shared {
bool rendering;
int currentFTGLErrorCount;
void internalRender(const string &text, float x, float y, bool centered, Vec3f *color);
void internalRender(const string &text, float x, float y, bool centered, Vec4f *color);
void specialFTGLErrorCheckWorkaround(string text);
public:
@@ -63,7 +63,7 @@ namespace Shared {
virtual ~TextRenderer3DGl();
virtual void begin(Font3D *font);
virtual void render(const string &text, float x, float y, bool centered = false, Vec3f *color = NULL);
virtual void render(const string &text, float x, float y, bool centered = false, Vec4f *color = NULL);
virtual void end();
};

View File

@@ -339,7 +339,6 @@ namespace Shared {
recycleUniqueColor();
}
//static const int COLOR_COMPONENTS = 3;
static const int COLOR_COMPONENTS = 4;
static void init(int bufferSize);
static void beginPicking();

View File

@@ -185,7 +185,7 @@ namespace Shared {
float speed;
float speedUpRelative;
float speedUpConstant;
Vec3f factionColor;
Vec4f factionColor;
bool teamcolorNoEnergy;
bool teamcolorEnergy;
int alternations;
@@ -268,7 +268,7 @@ namespace Shared {
void setParticleSystemStartDelay(int delay) {
this->particleSystemStartDelay = delay;
}
virtual void setFactionColor(Vec3f factionColor);
virtual void setFactionColor(Vec4f factionColor);
static BlendMode strToBlendMode(const string &str);
//misc

View File

@@ -28,7 +28,7 @@ namespace Shared {
class TextRenderer {
public:
virtual void render(const string &text, float x, float y, bool centered = false, Vec3f *color = NULL) = 0;
virtual void render(const string &text, float x, float y, bool centered = false, Vec4f *color = NULL) = 0;
virtual void end() = 0;
virtual ~TextRenderer() {

View File

@@ -745,7 +745,7 @@ namespace Shared {
x += v.x;
y += v.y;
z += v.z;
w += w.z;
w += v.w;
return *this;
}
@@ -753,7 +753,7 @@ namespace Shared {
x -= v.x;
y -= v.y;
z -= v.z;
w -= w.z;
w -= v.w;
return *this;
}
inline bool operator <(const Vec4<T> &v) const {

View File

@@ -48,7 +48,7 @@ namespace Shared {
rendering = true;
}
void TextRenderer2DGl::render(const string &text, float x, float y, bool centered, Vec3f *color) {
void TextRenderer2DGl::render(const string &text, float x, float y, bool centered, Vec4f *color) {
if (SystemFlags::VERBOSE_MODE_ENABLED) printf("**** RENDERING 2D text [%s]\n", text.c_str());
assert(rendering);
@@ -57,7 +57,7 @@ namespace Shared {
if (color != NULL) {
glPushAttrib(GL_CURRENT_BIT);
glColor3fv(color->ptr());
glColor4fv(color->ptr());
}
string renderText = text;
@@ -377,7 +377,7 @@ namespace Shared {
//assertGl();
}
void TextRenderer3DGl::render(const string &text, float x, float y, bool centered, Vec3f *color) {
void TextRenderer3DGl::render(const string &text, float x, float y, bool centered, Vec4f *color) {
assert(rendering);
if (text.empty() == false) {
@@ -433,7 +433,7 @@ namespace Shared {
//}
}
void TextRenderer3DGl::internalRender(const string &text, float x, float y, bool centered, Vec3f *color) {
void TextRenderer3DGl::internalRender(const string &text, float x, float y, bool centered, Vec4f *color) {
//assert(rendering);
if (color != NULL) {
@@ -442,7 +442,7 @@ namespace Shared {
//assertGl();
glColor3fv(color->ptr());
glColor4fv(color->ptr());
//assertGl();
}

View File

@@ -526,8 +526,8 @@ namespace Shared {
particleSize = particleSystemNode->getAttribute("particleSize")->getFloatValue();
// float speed;
speed = particleSystemNode->getAttribute("speed")->getFloatValue();
// Vec3f factionColor;
factionColor = Vec3f::strToVec3(particleSystemNode->getAttribute("factionColor")->getValue());
// Vec4f factionColor;
factionColor = Vec4f::strToVec4(particleSystemNode->getAttribute("factionColor")->getValue());
// bool teamcolorNoEnergy;
teamcolorNoEnergy = particleSystemNode->getAttribute("teamcolorNoEnergy")->getIntValue() != 0;
// bool teamcolorEnergy;
@@ -627,7 +627,7 @@ namespace Shared {
aliveParticleCount--;
}
void ParticleSystem::setFactionColor(Vec3f factionColor) {
void ParticleSystem::setFactionColor(Vec4f factionColor) {
this->factionColor = factionColor;
Vec3f tmpCol;