workaround poorly visible white lights on bright grid background (use eclass color)

fixes #178
This commit is contained in:
Garux
2025-01-31 08:29:11 +05:00
parent 242a481259
commit 256bbfd2fa
5 changed files with 32 additions and 23 deletions
+1
View File
@@ -123,6 +123,7 @@ public:
virtual void connectEntities( const scene::Path& e1, const scene::Path& e2, int index ) = 0;
virtual void setLightColorize( bool lightColorize ) = 0;
virtual void setLightRadii( bool lightRadii ) = 0;
virtual bool getLightRadii() = 0;
virtual void setShowNames( bool showNames ) = 0;
+25 -21
View File
@@ -119,6 +119,7 @@ int g_showNamesRatio = 64;
bool g_showTargetNames = false;
bool g_showAngles = true;
bool g_lightRadii = true;
bool g_lightColorize = true;
bool g_stupidQuakeBug = false;
@@ -149,16 +150,16 @@ inline Entity* ScenePath_getEntity( const scene::Path& path ){
class Quake3EntityCreator : public EntityCreator
{
public:
scene::Node& createEntity( EntityClass* eclass ){
scene::Node& createEntity( EntityClass* eclass ) override {
return node_for_eclass( eclass );
}
void setKeyValueChangedFunc( KeyValueChangedFunc func ){
void setKeyValueChangedFunc( KeyValueChangedFunc func ) override {
EntityKeyValues::setKeyValueChangedFunc( func );
}
void setCounter( Counter* counter ){
void setCounter( Counter* counter ) override {
EntityKeyValues::setCounter( counter );
}
void connectEntities( const scene::Path& path, const scene::Path& targetPath, int index ){
void connectEntities( const scene::Path& path, const scene::Path& targetPath, int index ) override {
Entity* e1 = ScenePath_getEntity( path );
Entity* e2 = ScenePath_getEntity( targetPath );
@@ -222,56 +223,59 @@ public:
}
SceneChangeNotify();
}
void setLightRadii( bool lightRadii ){
void setLightColorize( bool lightColorize ) override {
g_lightColorize = lightColorize;
}
void setLightRadii( bool lightRadii ) override {
g_lightRadii = lightRadii;
}
bool getLightRadii(){
bool getLightRadii() override {
return g_lightRadii;
}
void setShowNames( bool showNames ){
void setShowNames( bool showNames ) override {
g_showNames = showNames;
}
bool getShowNames(){
bool getShowNames() override {
return g_showNames;
}
void setShowBboxes( bool showBboxes ){
void setShowBboxes( bool showBboxes ) override {
g_showBboxes = showBboxes;
}
bool getShowBboxes(){
bool getShowBboxes() override {
return g_showBboxes;
}
void setShowConnections( bool showConnections ){
void setShowConnections( bool showConnections ) override {
g_showConnections = showConnections;
}
bool getShowConnections(){
bool getShowConnections() override {
return g_showConnections;
}
void setShowNamesDist( int dist ){
void setShowNamesDist( int dist ) override {
g_showNamesDist = dist;
}
int getShowNamesDist(){
int getShowNamesDist() override {
return g_showNamesDist;
}
void setShowNamesRatio( int ratio ){
void setShowNamesRatio( int ratio ) override {
g_showNamesRatio = ratio;
}
int getShowNamesRatio(){
int getShowNamesRatio() override {
return g_showNamesRatio;
}
void setShowTargetNames( bool showNames ){
void setShowTargetNames( bool showNames ) override {
g_showTargetNames = showNames;
}
bool getShowTargetNames(){
bool getShowTargetNames() override {
return g_showTargetNames;
}
void setShowAngles( bool showAngles ){
void setShowAngles( bool showAngles ) override {
g_showAngles = showAngles;
}
bool getShowAngles(){
bool getShowAngles() override {
return g_showAngles;
}
void printStatistics() const {
void printStatistics() const override {
StringPool_analyse( EntityKeyValues::getPool() );
}
};
+1
View File
@@ -46,5 +46,6 @@ extern int g_showNamesRatio;
extern bool g_showTargetNames;
extern bool g_showAngles;
extern bool g_lightRadii;
extern bool g_lightColorize;
extern bool g_stupidQuakeBug;
+3 -1
View File
@@ -1441,7 +1441,9 @@ public:
mutable Matrix4 m_projectionOrientation;
void renderSolid( Renderer& renderer, const VolumeTest& volume, const Matrix4& localToWorld, bool selected ) const {
renderer.SetState( m_colour.state(), Renderer::eWireframeOnly );
renderer.SetState( g_lightColorize
? m_colour.state()
: m_entity.getEntityClass().m_state_wire, Renderer::eWireframeOnly );
renderer.SetState( m_colour.state(), Renderer::eFullMaterials );
renderer.addRenderable( *this, localToWorld );
+2 -1
View File
@@ -1808,6 +1808,8 @@ void XYWnd::updateModelview(){
void XYWnd::XY_Draw(){
// globalOutputStream() << "XY_Draw()\n";
/* workaround poorly visible white lights on bright background */
GlobalEntityCreator().setLightColorize( vector3_min_component( g_xywindow_globals.color_gridback ) < .9f );
//
// clear
//
@@ -1815,7 +1817,6 @@ void XYWnd::XY_Draw(){
gl().glClearColor( g_xywindow_globals.color_gridback[0],
g_xywindow_globals.color_gridback[1],
g_xywindow_globals.color_gridback[2], 0 );
gl().glClear( GL_COLOR_BUFFER_BIT );
extern void Renderer_ResetStats();