diff --git a/contrib/bobtoolz/DTrainDrawer.cpp b/contrib/bobtoolz/DTrainDrawer.cpp index 426ec519..431fb0fb 100644 --- a/contrib/bobtoolz/DTrainDrawer.cpp +++ b/contrib/bobtoolz/DTrainDrawer.cpp @@ -205,7 +205,7 @@ void operator()( scene::Instance& instance ) const { AddSplineControl( control, pSP ); for ( int j = 2;; j++ ) { - char buffer[16]; + char buffer[32]; sprintf( buffer, "control%i", j ); e.SpawnString( buffer, NULL, &control ); diff --git a/libs/picomodel/pm_ms3d.c b/libs/picomodel/pm_ms3d.c index c2aba845..08b455a9 100644 --- a/libs/picomodel/pm_ms3d.c +++ b/libs/picomodel/pm_ms3d.c @@ -202,12 +202,12 @@ static picoModel_t *_ms3d_load( PM_PARAMS_LOAD ){ picoModel_t *model; unsigned char *bufptr, *bufptr0; int shaderRefs[ MS3D_MAX_GROUPS ]; - int numGroups; - int numMaterials; + int numGroups = 0; + int numMaterials = 0; // unsigned char *ptrToGroups; - int numVerts; + int numVerts = 0; unsigned char *ptrToVerts; - int numTris; + int numTris = 0; unsigned char *ptrToTris; int i,k,m; diff --git a/radiant/brush_primit.cpp b/radiant/brush_primit.cpp index 2f3237fd..39c60f23 100644 --- a/radiant/brush_primit.cpp +++ b/radiant/brush_primit.cpp @@ -239,55 +239,6 @@ void Texdef_normalise( TextureProjection& projection, float width, float height } } -//++timo replace everywhere texX by texS etc. ( ----> and in q3map !) -// NOTE : ComputeAxisBase here and in q3map code must always BE THE SAME ! -// WARNING : special case behaviour of atan2(y,x) <-> atan(y/x) might not be the same everywhere when x == 0 -// rotation by (0,RotY,RotZ) assigns X to normal -template -void ComputeAxisBase( const BasicVector3& normal, BasicVector3& texS, BasicVector3& texT ){ -#if 1 - const BasicVector3 up( 0, 0, 1 ); - const BasicVector3 down( 0, 0, -1 ); - - if ( vector3_equal_epsilon( normal, up, Element(1e-6) ) ) { - texS = BasicVector3( 0, 1, 0 ); - texT = BasicVector3( 1, 0, 0 ); - } - else if ( vector3_equal_epsilon( normal, down, Element(1e-6) ) ) { - texS = BasicVector3( 0, 1, 0 ); - texT = BasicVector3( -1, 0, 0 ); - } - else - { - texS = vector3_normalised( vector3_cross( normal, up ) ); - texT = vector3_normalised( vector3_cross( normal, texS ) ); - vector3_negate( texS ); - } - -#else - float RotY,RotZ; - // do some cleaning - /* - if (fabs(normal[0])<1e-6) - normal[0]=0.0f; - if (fabs(normal[1])<1e-6) - normal[1]=0.0f; - if (fabs(normal[2])<1e-6) - normal[2]=0.0f; - */ - RotY = -atan2( normal[2],sqrt( normal[1] * normal[1] + normal[0] * normal[0] ) ); - RotZ = atan2( normal[1],normal[0] ); - // rotate (0,1,0) and (0,0,1) to compute texS and texT - texS[0] = -sin( RotZ ); - texS[1] = cos( RotZ ); - texS[2] = 0; - // the texT vector is along -Z ( T texture coorinates axis ) - texT[0] = -sin( RotY ) * cos( RotZ ); - texT[1] = -sin( RotY ) * sin( RotZ ); - texT[2] = -cos( RotY ); -#endif -} - inline void DebugAxisBase( const Vector3& normal ){ Vector3 x, y; ComputeAxisBase( normal, x, y ); diff --git a/radiant/brush_primit.h b/radiant/brush_primit.h index 7c95bfb5..6c0569cf 100644 --- a/radiant/brush_primit.h +++ b/radiant/brush_primit.h @@ -133,7 +133,54 @@ extern float g_texdef_default_scale; void Texdef_Convert( TexdefTypeId in, TexdefTypeId out, const Plane3& plane, TextureProjection& projection, std::size_t width, std::size_t height ); void Texdef_from_ST( TextureProjection& projection, const DoubleVector3 points[3], const DoubleVector3 st[3], std::size_t width, std::size_t height ); + +//++timo replace everywhere texX by texS etc. ( ----> and in q3map !) +// NOTE : ComputeAxisBase here and in q3map code must always BE THE SAME ! +// WARNING : special case behaviour of atan2(y,x) <-> atan(y/x) might not be the same everywhere when x == 0 +// rotation by (0,RotY,RotZ) assigns X to normal template -void ComputeAxisBase( const BasicVector3& normal, BasicVector3& texS, BasicVector3& texT ); +inline void ComputeAxisBase( const BasicVector3& normal, BasicVector3& texS, BasicVector3& texT ){ +#if 1 + const BasicVector3 up( 0, 0, 1 ); + const BasicVector3 down( 0, 0, -1 ); + + if ( vector3_equal_epsilon( normal, up, Element(1e-6) ) ) { + texS = BasicVector3( 0, 1, 0 ); + texT = BasicVector3( 1, 0, 0 ); + } + else if ( vector3_equal_epsilon( normal, down, Element(1e-6) ) ) { + texS = BasicVector3( 0, 1, 0 ); + texT = BasicVector3( -1, 0, 0 ); + } + else + { + texS = vector3_normalised( vector3_cross( normal, up ) ); + texT = vector3_normalised( vector3_cross( normal, texS ) ); + vector3_negate( texS ); + } + +#else + float RotY,RotZ; + // do some cleaning + /* + if (fabs(normal[0])<1e-6) + normal[0]=0.0f; + if (fabs(normal[1])<1e-6) + normal[1]=0.0f; + if (fabs(normal[2])<1e-6) + normal[2]=0.0f; + */ + RotY = -atan2( normal[2],sqrt( normal[1] * normal[1] + normal[0] * normal[0] ) ); + RotZ = atan2( normal[1],normal[0] ); + // rotate (0,1,0) and (0,0,1) to compute texS and texT + texS[0] = -sin( RotZ ); + texS[1] = cos( RotZ ); + texS[2] = 0; + // the texT vector is along -Z ( T texture coorinates axis ) + texT[0] = -sin( RotY ) * cos( RotZ ); + texT[1] = -sin( RotY ) * sin( RotZ ); + texT[2] = -cos( RotY ); +#endif +} #endif diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index c53a01d8..85dd0459 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -602,10 +602,10 @@ XYWnd::XYWnd() : m_gl_widget( glwidget_new( FALSE ) ), m_deferredDraw( WidgetQueueDrawCaller( *m_gl_widget ) ), m_deferred_motion( xywnd_motion, this ), + m_fbo( 0 ), m_parent( 0 ), m_window_observer( NewWindowObserver() ), - m_chasemouse_handler( 0 ), - m_fbo( 0 ) + m_chasemouse_handler( 0 ) { m_bActive = false; m_buttonstate = 0; diff --git a/radiant/xywindow.h b/radiant/xywindow.h index 82b57f48..54db5103 100644 --- a/radiant/xywindow.h +++ b/radiant/xywindow.h @@ -87,9 +87,11 @@ guint m_exposeHandler; DeferredDraw m_deferredDraw; DeferredMotion m_deferred_motion; -public: + FBO* m_fbo; +public: FBO* fbo_get(); + GtkWindow* m_parent; XYWnd(); ~XYWnd(); @@ -101,7 +103,6 @@ GtkWidget* GetWidget(){ return m_gl_widget; } -public: SelectionSystemWindowObserver* m_window_observer; XORRectangle m_XORRectangle; WindowPositionTracker m_positionTracker;