Radiant:
misc... * new very fast entity names rendering system * render entity names in cam within < 512u dist or if selected
This commit is contained in:
@@ -1138,6 +1138,7 @@ inline void setFogState( const OpenGLFogState& state ){
|
||||
}
|
||||
|
||||
#define DEBUG_SHADERS 0
|
||||
void OpenGLState_apply( const OpenGLState& self, OpenGLState& current, unsigned int globalstate );
|
||||
|
||||
class OpenGLShaderCache : public ShaderCache, public TexturesCacheObserver, public ModuleObserver
|
||||
{
|
||||
@@ -1312,6 +1313,10 @@ void render( RenderStateFlags globalstate, const Matrix4& modelview, const Matri
|
||||
( *i ).second->render( current, globalstate, viewer );
|
||||
}
|
||||
debug_string( "end rendering" );
|
||||
|
||||
OpenGLState reset = current; /* popmatrix and reset stuff after RENDER_TEXT */
|
||||
reset.m_state = current.m_state & ~RENDER_TEXT;
|
||||
OpenGLState_apply( reset, current, globalstate );
|
||||
}
|
||||
void realise(){
|
||||
if ( --m_unrealised == 0 ) {
|
||||
@@ -1620,6 +1625,26 @@ void OpenGLState_apply( const OpenGLState& self, OpenGLState& current, unsigned
|
||||
|
||||
GlobalOpenGL_debugAssertNoErrors();
|
||||
|
||||
if ( delta & ~state & RENDER_TEXT ) { /* disabling in the beginning, so wont override other states */
|
||||
if ( GlobalOpenGL().GL_1_3() ) { ///~RENDER_TEXTURE
|
||||
glActiveTexture( GL_TEXTURE0 );
|
||||
glClientActiveTexture( GL_TEXTURE0 );
|
||||
}
|
||||
glDisable( GL_TEXTURE_2D );
|
||||
glBindTexture( GL_TEXTURE_2D, 0 );
|
||||
|
||||
glDisable( GL_BLEND ); ///~RENDER_BLEND
|
||||
|
||||
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); ///~RENDER_FILL
|
||||
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glPopMatrix();
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glPopMatrix();
|
||||
|
||||
GlobalOpenGL_debugAssertNoErrors();
|
||||
}
|
||||
|
||||
GLProgram* program = ( state & RENDER_PROGRAM ) != 0 ? self.m_program : 0;
|
||||
|
||||
if ( program != current.m_program ) {
|
||||
@@ -1709,6 +1734,7 @@ void OpenGLState_apply( const OpenGLState& self, OpenGLState& current, unsigned
|
||||
glActiveTexture( GL_TEXTURE0 );
|
||||
}
|
||||
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL );
|
||||
//glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); //uses actual alpha channel, = invis, if qer_trans + empty alpha channel
|
||||
GlobalOpenGL_debugAssertNoErrors();
|
||||
}
|
||||
else if ( delta & ~state & RENDER_BLEND ) {
|
||||
@@ -1829,6 +1855,34 @@ void OpenGLState_apply( const OpenGLState& self, OpenGLState& current, unsigned
|
||||
current.m_alpharef = self.m_alpharef;
|
||||
}
|
||||
|
||||
if ( delta & state & RENDER_TEXT ) { /* enabling in the end, so other states can't affect */
|
||||
if ( GlobalOpenGL().GL_1_3() ) { ///RENDER_TEXTURE
|
||||
glActiveTexture( GL_TEXTURE0 );
|
||||
glClientActiveTexture( GL_TEXTURE0 );
|
||||
}
|
||||
glEnable( GL_TEXTURE_2D );
|
||||
|
||||
glEnable( GL_BLEND ); ///RENDER_BLEND
|
||||
//glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL );
|
||||
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); //uses actual alpha channel, = invis, if qer_trans + empty alpha channel
|
||||
|
||||
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); ///RENDER_FILL
|
||||
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
GLint viewprt[4];
|
||||
glGetIntegerv( GL_VIEWPORT, viewprt );
|
||||
//globalOutputStream() << viewprt[2] << " " << viewprt[3] << "\n";
|
||||
glOrtho( 0, viewprt[2], 0, viewprt[3], -100, 100 );
|
||||
glTranslated( double( viewprt[2] ) / 2.0, double( viewprt[3] ) / 2.0, 0 );
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
|
||||
GlobalOpenGL_debugAssertNoErrors();
|
||||
}
|
||||
|
||||
{
|
||||
GLint texture0 = 0;
|
||||
GLint texture1 = 0;
|
||||
@@ -2084,9 +2138,13 @@ void OpenGLShader::construct( const char* name ){
|
||||
case '{': //add
|
||||
sscanf( name, "{%g %g %g}", &state.m_colour[0], &state.m_colour[1], &state.m_colour[2] );
|
||||
state.m_colour[3] = 1.0f;
|
||||
state.m_state = RENDER_CULLFACE | RENDER_DEPTHTEST | RENDER_BLEND | RENDER_FILL | RENDER_COLOURWRITE /*| RENDER_DEPTHWRITE*/ | RENDER_LIGHTING;
|
||||
state.m_state = RENDER_CULLFACE | RENDER_DEPTHTEST | RENDER_BLEND | RENDER_FILL | RENDER_COLOURWRITE /*| RENDER_DEPTHWRITE */| RENDER_LIGHTING;
|
||||
state.m_blend_src = GL_ONE;
|
||||
state.m_blend_dst = GL_ONE;
|
||||
// state.m_blend_src = GL_DST_COLOR;
|
||||
// state.m_blend_dst = GL_SRC_COLOR;
|
||||
// state.m_blend_src = GL_DST_COLOR;
|
||||
// state.m_blend_dst = GL_ONE;
|
||||
state.m_sort = OpenGLState::eSortTranslucent;
|
||||
break;
|
||||
|
||||
@@ -2122,7 +2180,18 @@ void OpenGLShader::construct( const char* name ){
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( string_equal( name + 1, "POINT" ) ) {
|
||||
if ( string_equal( name + 1, "TEXT" ) ) {
|
||||
state.m_colour[0] = 1.f;
|
||||
state.m_colour[1] = 1.f;
|
||||
state.m_colour[2] = 1.f;
|
||||
state.m_colour[3] = 1.f;
|
||||
state.m_state = RENDER_CULLFACE | RENDER_COLOURWRITE /*| RENDER_DEPTHTEST | RENDER_DEPTHWRITE*/ /*| RENDER_FILL | RENDER_TEXTURE | RENDER_BLEND */| RENDER_TEXT;
|
||||
state.m_sort = OpenGLState::eSortText;
|
||||
state.m_blend_src = GL_SRC_ALPHA;
|
||||
state.m_blend_dst = GL_ONE_MINUS_SRC_ALPHA;
|
||||
//state.m_depthfunc = GL_LEQUAL;
|
||||
}
|
||||
else if ( string_equal( name + 1, "POINT" ) ) {
|
||||
state.m_state = RENDER_COLOURARRAY | RENDER_COLOURWRITE | RENDER_DEPTHWRITE;
|
||||
state.m_sort = OpenGLState::eSortControlFirst;
|
||||
state.m_pointsize = 4;
|
||||
|
||||
Reference in New Issue
Block a user