meshes can glow

This commit is contained in:
titiger
2015-03-18 20:21:59 +01:00
parent 14f04c5c35
commit b3cf4bf1fd
10 changed files with 925 additions and 3181 deletions

View File

@@ -175,6 +175,12 @@ void ModelRendererGl::renderMesh(Mesh *mesh,int renderMode) {
glEnable(GL_CULL_FACE);
}
if(renderMode==rmNormal && mesh->getGlow()==true){
// glow on
glDisable(GL_LIGHTING);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
}
if(this->colorPickingMode == false) {
//set color
if(renderColors) {
@@ -324,6 +330,12 @@ void ModelRendererGl::renderMesh(Mesh *mesh,int renderMode) {
glDrawRangeElements(GL_TRIANGLES, 0, vertexCount-1, indexCount, GL_UNSIGNED_INT, mesh->getIndices());
}
// glow
if(renderMode==rmNormal && mesh->getGlow()==true){
// glow off
glEnable(GL_LIGHTING);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
//assertions
assertGl();
}

View File

@@ -225,6 +225,7 @@ Mesh::Mesh() {
twoSided= false;
customColor= false;
noSelect= false;
glow= false;
textureFlags=0;
@@ -446,6 +447,7 @@ void Mesh::loadV2(int meshIndex, const string &dir, FILE *f, TextureManager *tex
twoSided= false;
customColor= false;
noSelect= false;
glow= false;
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Load v2, this = %p Found meshHeader.hasTexture = %d, texName [%s] mtDiffuse = %d meshIndex = %d modelFile [%s]\n",this,meshHeader.hasTexture,toLower(reinterpret_cast<char*>(meshHeader.texName)).c_str(),mtDiffuse,meshIndex,modelFile.c_str());
@@ -586,6 +588,7 @@ void Mesh::loadV3(int meshIndex, const string &dir, FILE *f,
twoSided= (meshHeader.properties & mp3TwoSided) != 0;
customColor= (meshHeader.properties & mp3CustomColor) != 0;
noSelect = false;
glow = false;
textureFlags= 0;
if((meshHeader.properties & mp3NoTexture) != mp3NoTexture) {
@@ -781,6 +784,7 @@ void Mesh::load(int meshIndex, const string &dir, FILE *f, TextureManager *textu
customColor= (meshHeader.properties & mpfCustomColor) != 0;
twoSided= (meshHeader.properties & mpfTwoSided) != 0;
noSelect= (meshHeader.properties & mpfNoSelect) != 0;
glow= (meshHeader.properties & mpfGlow) != 0;
//material
diffuseColor= Vec3f(meshHeader.diffuseColor);
@@ -900,6 +904,9 @@ void Mesh::save(int meshIndex, const string &dir, FILE *f, TextureManager *textu
if(noSelect) {
meshHeader.properties |= mpfNoSelect;
}
if(glow) {
meshHeader.properties |= mpfGlow;
}
meshHeader.textures = textureFlags;
fwrite(&meshHeader, sizeof(MeshHeader), 1, f);
@@ -1532,6 +1539,7 @@ void Mesh::copyInto(Mesh *dest, bool ignoreInterpolationData,
dest->twoSided = this->twoSided;
dest->customColor = this->customColor;
dest->noSelect = this->noSelect;
dest->glow = this->glow;
dest->textureFlags = this->textureFlags;
@@ -1605,6 +1613,7 @@ void Model::autoJoinMeshFrames() {
string("_") + intToStr(mesh.getCustomTexture()) +
string("_") + intToStr(mesh.getNoSelect()) +
string("_") + floatToStr(mesh.getOpacity()) +
string("_") + floatToStr(mesh.getGlow()) +
string("_") + mesh.getDiffuseColor().getString() +
string("_") + mesh.getSpecularColor().getString() +
string("_") + floatToStr(mesh.getSpecularPower());