clean namedentity, forward declarations, ostream_write
This commit is contained in:
parent
327fa13d54
commit
eae7ac024a
|
|
@ -22,12 +22,7 @@
|
||||||
#if !defined( INCLUDED_EDITABLE_H )
|
#if !defined( INCLUDED_EDITABLE_H )
|
||||||
#define INCLUDED_EDITABLE_H
|
#define INCLUDED_EDITABLE_H
|
||||||
|
|
||||||
template<typename Element> class BasicVector3;
|
|
||||||
typedef BasicVector3<float> Vector3;
|
|
||||||
template<typename Element> class BasicVector4;
|
|
||||||
typedef BasicVector4<float> Vector4;
|
|
||||||
class Matrix4;
|
class Matrix4;
|
||||||
typedef Vector4 Quaternion;
|
|
||||||
|
|
||||||
#include "scenelib.h"
|
#include "scenelib.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include "generic/constant.h"
|
#include "generic/constant.h"
|
||||||
#include "generic/callbackfwd.h"
|
#include "generic/callbackfwd.h"
|
||||||
|
#include "generic/vector.h"
|
||||||
|
|
||||||
|
|
||||||
// Rendering states to sort by.
|
// Rendering states to sort by.
|
||||||
|
|
@ -60,9 +61,6 @@ typedef unsigned int RenderStateFlags;
|
||||||
class AABB;
|
class AABB;
|
||||||
class Matrix4;
|
class Matrix4;
|
||||||
|
|
||||||
template<typename Element> class BasicVector3;
|
|
||||||
typedef BasicVector3<float> Vector3;
|
|
||||||
|
|
||||||
class Shader;
|
class Shader;
|
||||||
|
|
||||||
class RendererLight
|
class RendererLight
|
||||||
|
|
@ -115,8 +113,6 @@ class Matrix4;
|
||||||
struct qtexture_t;
|
struct qtexture_t;
|
||||||
class ModuleObserver;
|
class ModuleObserver;
|
||||||
|
|
||||||
#include "generic/vector.h"
|
|
||||||
|
|
||||||
class Shader
|
class Shader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,6 @@ template<typename Element> class BasicVector3;
|
||||||
typedef BasicVector3<float> Vector3;
|
typedef BasicVector3<float> Vector3;
|
||||||
template<typename Element> class BasicVector4;
|
template<typename Element> class BasicVector4;
|
||||||
typedef BasicVector4<float> Vector4;
|
typedef BasicVector4<float> Vector4;
|
||||||
class Matrix4;
|
|
||||||
typedef Vector4 Quaternion;
|
typedef Vector4 Quaternion;
|
||||||
|
|
||||||
typedef Callback1<const Selectable&> SelectionChangeCallback;
|
typedef Callback1<const Selectable&> SelectionChangeCallback;
|
||||||
|
|
|
||||||
|
|
@ -42,10 +42,6 @@ enum
|
||||||
|
|
||||||
struct qtexture_t;
|
struct qtexture_t;
|
||||||
|
|
||||||
template<typename Element> class BasicVector3;
|
|
||||||
typedef BasicVector3<float> Vector3;
|
|
||||||
typedef Vector3 Colour3;
|
|
||||||
|
|
||||||
typedef unsigned char BlendFactor;
|
typedef unsigned char BlendFactor;
|
||||||
const BlendFactor BLEND_ZERO = 0;
|
const BlendFactor BLEND_ZERO = 0;
|
||||||
const BlendFactor BLEND_ONE = 1;
|
const BlendFactor BLEND_ONE = 1;
|
||||||
|
|
|
||||||
|
|
@ -120,8 +120,6 @@ virtual Type* findModule( const char* name ) = 0;
|
||||||
virtual void foreachModule( const Visitor& visitor ) = 0;
|
virtual void foreachModule( const Visitor& visitor ) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "debugging/debugging.h"
|
|
||||||
|
|
||||||
template<typename Type>
|
template<typename Type>
|
||||||
class ModuleRef
|
class ModuleRef
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -219,13 +219,9 @@ pointer m_indices;
|
||||||
pointer m_finish;
|
pointer m_finish;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Element> class BasicVector3;
|
|
||||||
typedef BasicVector3<float> Vector3;
|
|
||||||
class Matrix4;
|
class Matrix4;
|
||||||
class VolumeTest;
|
class VolumeTest;
|
||||||
|
|
||||||
typedef BasicVector3<double> DoubleVector3;
|
|
||||||
|
|
||||||
class SelectionTest
|
class SelectionTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -205,8 +205,22 @@ typedef BasicVector2<float> Vector2;
|
||||||
/// \brief A 3-element vector stored in single-precision floating-point.
|
/// \brief A 3-element vector stored in single-precision floating-point.
|
||||||
typedef BasicVector3<float> Vector3;
|
typedef BasicVector3<float> Vector3;
|
||||||
|
|
||||||
|
/// \brief A 3-element vector stored in double-precision floating-point.
|
||||||
|
typedef BasicVector3<double> DoubleVector3;
|
||||||
|
|
||||||
/// \brief A 4-element vector stored in single-precision floating-point.
|
/// \brief A 4-element vector stored in single-precision floating-point.
|
||||||
typedef BasicVector4<float> Vector4;
|
typedef BasicVector4<float> Vector4;
|
||||||
|
|
||||||
|
|
||||||
|
template<typename TextOutputStreamType>
|
||||||
|
inline TextOutputStreamType& ostream_write( TextOutputStreamType& outputStream, const Vector3& v ){
|
||||||
|
return outputStream << '(' << v.x() << ' ' << v.y() << ' ' << v.z() << ')';
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename TextOutputStreamType>
|
||||||
|
TextOutputStreamType& ostream_write( TextOutputStreamType& t, const Vector4& v ){
|
||||||
|
return t << "[ " << v.x() << " " << v.y() << " " << v.z() << " " << v.w() << " ]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1156,13 +1156,9 @@ inline void matrix4_pivoted_transform_by_euler_xyz_degrees( Matrix4& self, const
|
||||||
matrix4_translate_by_vec3( self, vector3_negated( pivotpoint ) );
|
matrix4_translate_by_vec3( self, vector3_negated( pivotpoint ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename TextOutputStreamType>
|
template<typename TextOutputStreamType>
|
||||||
inline TextOutputStreamType& ostream_write( TextOutputStreamType& ostream, const Matrix4& m ){
|
inline TextOutputStreamType& ostream_write( TextOutputStreamType& ostream, const Matrix4& m ){
|
||||||
return ostream << "[ " << m[0] << " " << m[1] << " " << m[2] << " " << m[3] << " ]*[ "
|
return ostream << m.x() << " " << m.y() << " " << m.z() << " " << m.t();
|
||||||
<< m[4] << " " << m[5] << " " << m[6] << " " << m[7] << " ]*[ "
|
|
||||||
<< m[8] << " " << m[9] << " " << m[10] << " " << m[11] << " ]*[ "
|
|
||||||
<< m[12] << " " << m[13] << " " << m[14] << " " << m[15] << " ]";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -38,14 +38,6 @@
|
||||||
|
|
||||||
class Selector;
|
class Selector;
|
||||||
class SelectionTest;
|
class SelectionTest;
|
||||||
class VolumeTest;
|
|
||||||
template<typename Element> class BasicVector3;
|
|
||||||
typedef BasicVector3<float> Vector3;
|
|
||||||
template<typename Element> class BasicVector4;
|
|
||||||
typedef BasicVector4<float> Vector4;
|
|
||||||
class Matrix4;
|
|
||||||
typedef Vector4 Quaternion;
|
|
||||||
class AABB;
|
|
||||||
|
|
||||||
class ComponentSelectionTestable
|
class ComponentSelectionTestable
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -288,11 +288,6 @@ inline bool Tokeniser_nextTokenIsDigit( Tokeniser& tokeniser ){
|
||||||
return std::isdigit( c ) != 0;
|
return std::isdigit( c ) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename TextOutputStreamType>
|
|
||||||
inline TextOutputStreamType& ostream_write( TextOutputStreamType& outputStream, const Vector3& v ){
|
|
||||||
return outputStream << '(' << v.x() << ' ' << v.y() << ' ' << v.z() << ')';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,8 +91,6 @@ typedef MemberCaller1<NamedEntity, const char*, &NamedEntity::identifierChanged>
|
||||||
|
|
||||||
|
|
||||||
#include "renderable.h"
|
#include "renderable.h"
|
||||||
//#include "pivot.h"
|
|
||||||
//#include "math/frustum.h"
|
|
||||||
#include "cullable.h"
|
#include "cullable.h"
|
||||||
|
|
||||||
class RenderableNamedEntity : public OpenGLRenderable {
|
class RenderableNamedEntity : public OpenGLRenderable {
|
||||||
|
|
@ -117,7 +115,6 @@ public:
|
||||||
}
|
}
|
||||||
RenderableNamedEntity( NamedEntity& named, const Vector3& position, const char* exclude = 0 )
|
RenderableNamedEntity( NamedEntity& named, const Vector3& position, const char* exclude = 0 )
|
||||||
: m_named( named ), m_position( position ), m_tex( 0 ), m_exclude( exclude ) {
|
: m_named( named ), m_position( position ), m_tex( 0 ), m_exclude( exclude ) {
|
||||||
// construct_textures( g_showTargetNames ? m_named.name() : m_named.classname() );
|
|
||||||
construct_textures( m_named.name() );
|
construct_textures( m_named.name() );
|
||||||
m_named.attach( IdentifierChangedCaller( *this ) );
|
m_named.attach( IdentifierChangedCaller( *this ) );
|
||||||
}
|
}
|
||||||
|
|
@ -182,76 +179,37 @@ public:
|
||||||
setMode( selected, childSelected );
|
setMode( selected, childSelected );
|
||||||
|
|
||||||
if( volume.fill() ){
|
if( volume.fill() ){
|
||||||
// globalOutputStream() << localToWorld << " localToWorld\n";
|
|
||||||
// globalOutputStream() << volume.GetModelview() << " modelview\n";
|
|
||||||
// globalOutputStream() << volume.GetProjection() << " Projection\n";
|
|
||||||
// globalOutputStream() << volume.GetViewport() << " Viewport\n";
|
|
||||||
//Matrix4 viewproj = matrix4_multiplied_by_matrix4( volume.GetProjection(), volume.GetModelview() );
|
|
||||||
const Matrix4& viewproj = volume.GetViewMatrix();
|
const Matrix4& viewproj = volume.GetViewMatrix();
|
||||||
//Vector3 viewer = vector4_to_vector3( viewer_from_viewproj( viewproj ) );
|
|
||||||
const Vector3 pos_in_world = matrix4_transformed_point( localToWorld, m_position );
|
const Vector3 pos_in_world = matrix4_transformed_point( localToWorld, m_position );
|
||||||
if( viewproj[3] * pos_in_world[0] + viewproj[7] * pos_in_world[1] + viewproj[11] * pos_in_world[2] + viewproj[15] < 3e-5 ) //z < 0: behind nearplane
|
if( viewproj[3] * pos_in_world[0] + viewproj[7] * pos_in_world[1] + viewproj[11] * pos_in_world[2] + viewproj[15] < 3e-5 ) //w < 0: behind nearplane
|
||||||
return;
|
return;
|
||||||
if( m_nameMode == eNameNormal && vector3_length_squared( pos_in_world - volume.getViewer() ) > static_cast<float>( g_showNamesDist ) * static_cast<float>( g_showNamesDist ) )
|
if( m_nameMode == eNameNormal && vector3_length_squared( pos_in_world - volume.getViewer() ) > static_cast<float>( g_showNamesDist ) * static_cast<float>( g_showNamesDist ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//globalOutputStream() << viewer[0] << " " << viewer[1] << " " << viewer[2] << " Viewer\n";
|
|
||||||
//globalOutputStream() << m_position[0] << " " << m_position[1] << " " << m_position[2] << " m_position\n";
|
|
||||||
//globalOutputStream() << pos_in_world[0] << " " << pos_in_world[1] << " " << pos_in_world[2] << " pos_in_world\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Vector4 position( m_position, 1.f );
|
Vector4 position( m_position, 1.f );
|
||||||
|
|
||||||
#if 0
|
|
||||||
// globalOutputStream() << position[0] << " " << position[1] << " " << position[2] << " " << position[3] << " position\n";
|
|
||||||
matrix4_transform_vector4( localToWorld, position );
|
|
||||||
// globalOutputStream() << position[0] << " " << position[1] << " " << position[2] << " " << position[3] << " localToWorld\n";
|
|
||||||
matrix4_transform_vector4( volume.GetModelview(), position );
|
|
||||||
// globalOutputStream() << position[0] << " " << position[1] << " " << position[2] << " " << position[3] << " Modelview\n";
|
|
||||||
matrix4_transform_vector4( volume.GetProjection(), position );
|
|
||||||
// globalOutputStream() << position[0] << " " << position[1] << " " << position[2] << " " << position[3] << " Projection\n";
|
|
||||||
position[0] /= position[3];
|
|
||||||
position[1] /= position[3];
|
|
||||||
position[2] /= position[3];
|
|
||||||
// globalOutputStream() << position[0] << " " << position[1] << " " << position[2] << " " << position[3] << " Projection division\n";
|
|
||||||
matrix4_transform_vector4( volume.GetViewport(), position );
|
|
||||||
// globalOutputStream() << position[0] << " " << position[1] << " " << position[2] << " " << position[3] << " Viewport\n";
|
|
||||||
|
|
||||||
#else
|
|
||||||
//Matrix4 object2screen = volume.GetProjection();
|
|
||||||
Matrix4 object2screen( volume.GetViewMatrix() );
|
Matrix4 object2screen( volume.GetViewMatrix() );
|
||||||
//matrix4_multiply_by_matrix4( object2screen, volume.GetModelview() );
|
|
||||||
matrix4_multiply_by_matrix4( object2screen, localToWorld );
|
matrix4_multiply_by_matrix4( object2screen, localToWorld );
|
||||||
// globalOutputStream() << position[0] << " " << position[1] << " " << position[2] << " " << position[3] << " position\n";
|
|
||||||
matrix4_transform_vector4( object2screen, position );
|
matrix4_transform_vector4( object2screen, position );
|
||||||
// globalOutputStream() << position[0] << " " << position[1] << " " << position[2] << " " << position[3] << " Projection\n";
|
// globalOutputStream() << position << " Projection\n";
|
||||||
position[0] /= position[3];
|
position[0] /= position[3];
|
||||||
position[1] /= position[3];
|
position[1] /= position[3];
|
||||||
position[2] /= position[3];
|
position[2] /= position[3];
|
||||||
// globalOutputStream() << position[0] << " " << position[1] << " " << position[2] << " " << position[3] << " Projection division\n";
|
// globalOutputStream() << position << " Projection division\n";
|
||||||
matrix4_transform_vector4( volume.GetViewport(), position );
|
matrix4_transform_vector4( volume.GetViewport(), position );
|
||||||
// globalOutputStream() << position[0] << " " << position[1] << " " << position[2] << " " << position[3] << " Viewport\n";
|
// globalOutputStream() << position << " Viewport\n";
|
||||||
#endif
|
// globalOutputStream() << volume.GetViewport()[0] << " " << volume.GetViewport()[5] << " Viewport size\n";
|
||||||
|
|
||||||
//globalOutputStream() << volume.GetViewport()[0] << " " << volume.GetViewport()[5] << " Viewport size\n";
|
|
||||||
|
|
||||||
m_screenPos[0] = position[0];
|
m_screenPos[0] = position[0];
|
||||||
m_screenPos[1] = position[1];
|
m_screenPos[1] = position[1];
|
||||||
//globalOutputStream() << m_screenPos[0] << " " << m_screenPos[1] << "\n";
|
// globalOutputStream() << m_screenPos[0] << " " << m_screenPos[1] << "\n";
|
||||||
|
|
||||||
renderer.PushState();
|
renderer.PushState();
|
||||||
|
|
||||||
// Pivot2World_viewplaneSpace( m_localToWorld, localToWorld, volume.GetModelview(), volume.GetProjection(), volume.GetViewport() );
|
|
||||||
|
|
||||||
renderer.Highlight( Renderer::ePrimitive, false );
|
renderer.Highlight( Renderer::ePrimitive, false );
|
||||||
renderer.Highlight( Renderer::eFace, false );
|
renderer.Highlight( Renderer::eFace, false );
|
||||||
renderer.SetState( getShader(), Renderer::eWireframeOnly );
|
renderer.SetState( getShader(), Renderer::eWireframeOnly );
|
||||||
renderer.SetState( getShader(), Renderer::eFullMaterials );
|
renderer.SetState( getShader(), Renderer::eFullMaterials );
|
||||||
|
|
||||||
// m_localToWorld = volume.GetViewport();
|
|
||||||
// matrix4_full_invert( m_localToWorld );
|
|
||||||
|
|
||||||
renderer.addRenderable( *this, g_matrix4_identity );
|
renderer.addRenderable( *this, g_matrix4_identity );
|
||||||
|
|
||||||
renderer.PopState();
|
renderer.PopState();
|
||||||
|
|
@ -262,7 +220,6 @@ public:
|
||||||
}
|
}
|
||||||
void identifierChanged( const char* value ){
|
void identifierChanged( const char* value ){
|
||||||
delete_textures();
|
delete_textures();
|
||||||
// construct_textures( g_showTargetNames ? value : m_named.classname() );
|
|
||||||
construct_textures( value );
|
construct_textures( value );
|
||||||
}
|
}
|
||||||
typedef MemberCaller1<RenderableNamedEntity, const char*, &RenderableNamedEntity::identifierChanged> IdentifierChangedCaller;
|
typedef MemberCaller1<RenderableNamedEntity, const char*, &RenderableNamedEntity::identifierChanged> IdentifierChangedCaller;
|
||||||
|
|
|
||||||
|
|
@ -73,18 +73,6 @@ const unsigned int BRUSH_DETAIL_MASK = ( 1 << BRUSH_DETAIL_FLAG );
|
||||||
#define BRUSH_DEGENERATE_DEBUG 0
|
#define BRUSH_DEGENERATE_DEBUG 0
|
||||||
|
|
||||||
|
|
||||||
inline void print_vector3( const Vector3& v ){
|
|
||||||
globalOutputStream() << "( " << v.x() << " " << v.y() << " " << v.z() << " )\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void print_3x3( const Matrix4& m ){
|
|
||||||
globalOutputStream() << "( " << m.xx() << " " << m.xy() << " " << m.xz() << " ) "
|
|
||||||
<< "( " << m.yx() << " " << m.yy() << " " << m.yz() << " ) "
|
|
||||||
<< "( " << m.zx() << " " << m.zy() << " " << m.zz() << " )\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
inline bool texdef_sane( const texdef_t& texdef ){
|
inline bool texdef_sane( const texdef_t& texdef ){
|
||||||
return fabs( texdef.shift[0] ) < ( 1 << 16 )
|
return fabs( texdef.shift[0] ) < ( 1 << 16 )
|
||||||
&& fabs( texdef.shift[1] ) < ( 1 << 16 );
|
&& fabs( texdef.shift[1] ) < ( 1 << 16 );
|
||||||
|
|
|
||||||
|
|
@ -89,12 +89,6 @@ float Texdef_getDefaultTextureScale();
|
||||||
|
|
||||||
class texdef_t;
|
class texdef_t;
|
||||||
struct Winding;
|
struct Winding;
|
||||||
template<typename Element> class BasicVector3;
|
|
||||||
typedef BasicVector3<float> Vector3;
|
|
||||||
typedef BasicVector3<double> DoubleVector3;
|
|
||||||
template<typename Element> class BasicVector4;
|
|
||||||
typedef BasicVector4<float> Vector4;
|
|
||||||
typedef Vector4 Quaternion;
|
|
||||||
class Matrix4;
|
class Matrix4;
|
||||||
class Plane3;
|
class Plane3;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,10 @@
|
||||||
#if !defined( INCLUDED_CSG_H )
|
#if !defined( INCLUDED_CSG_H )
|
||||||
#define INCLUDED_CSG_H
|
#define INCLUDED_CSG_H
|
||||||
|
|
||||||
void CSG_MakeRoom( void );
|
void CSG_MakeRoom();
|
||||||
void CSG_Subtract( void );
|
void CSG_Subtract();
|
||||||
void CSG_Merge( void );
|
void CSG_Merge();
|
||||||
void CSG_Tool( void );
|
void CSG_Tool();
|
||||||
|
|
||||||
namespace scene
|
namespace scene
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -523,8 +523,6 @@ AnglesEntry() : m_roll( 0 ), m_pitch( 0 ), m_yaw( 0 ){
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef BasicVector3<double> DoubleVector3;
|
|
||||||
|
|
||||||
class AnglesAttribute : public EntityAttribute
|
class AnglesAttribute : public EntityAttribute
|
||||||
{
|
{
|
||||||
CopiedString m_key;
|
CopiedString m_key;
|
||||||
|
|
|
||||||
|
|
@ -52,14 +52,6 @@
|
||||||
|
|
||||||
#include "grid.h"
|
#include "grid.h"
|
||||||
|
|
||||||
TextOutputStream& ostream_write( TextOutputStream& t, const Vector4& v ){
|
|
||||||
return t << "[ " << v.x() << " " << v.y() << " " << v.z() << " " << v.w() << " ]";
|
|
||||||
}
|
|
||||||
|
|
||||||
TextOutputStream& ostream_write( TextOutputStream& t, const Matrix4& m ){
|
|
||||||
return t << "[ " << m.x() << " " << m.y() << " " << m.z() << " " << m.t() << " ]";
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Pivot2World
|
struct Pivot2World
|
||||||
{
|
{
|
||||||
Matrix4 m_worldSpace;
|
Matrix4 m_worldSpace;
|
||||||
|
|
|
||||||
|
|
@ -148,8 +148,6 @@ struct Winding
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef BasicVector3<double> DoubleVector3;
|
|
||||||
|
|
||||||
class DoubleLine
|
class DoubleLine
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user