]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/brush.h
Merge commit '00a7e0326354f7837338661c2307412f5beba9fb' into master-merge
[xonotic/netradiant.git] / radiant / brush.h
index 298b161bd549c37b2cc71d6289a2ed14493cbdf0..3249cda0f2d994c4ff0f8aa3eaef260e5238db97 100644 (file)
@@ -307,7 +307,6 @@ class FaceShaderObserver
 {
 public:
 virtual void realiseShader() = 0;
-
 virtual void unrealiseShader() = 0;
 };
 
@@ -362,7 +361,7 @@ SavedState( const FaceShader& faceShader ){
 
 void exportState( FaceShader& faceShader ) const {
        faceShader.setShader( m_shader.c_str() );
-       faceShader.setFlags( m_flags );
+                       faceShader.m_flags = m_flags;
 }
 };
 
@@ -600,14 +599,6 @@ void fit( const Vector3& normal, const Winding& winding, float s_repeat, float t
        Texdef_FitTexture( m_projection, m_shader.width(), m_shader.height(), normal, winding, s_repeat, t_repeat );
 }
 
-void fitW( const Vector3& normal, const Winding& winding, float s_repeat, float t_repeat ){
-       Texdef_FitTextureW( m_projection, m_shader.width(), m_shader.height(), normal, winding, s_repeat, t_repeat );
-}
-
-void fitH( const Vector3& normal, const Winding& winding, float s_repeat, float t_repeat ){
-       Texdef_FitTextureH( m_projection, m_shader.width(), m_shader.height(), normal, winding, s_repeat, t_repeat );
-}
-
 void emitTextureCoordinates( Winding& winding, const Vector3& normal, const Matrix4& localToWorld ){
        Texdef_EmitTextureCoordinates( m_projection, m_shader.width(), m_shader.height(), winding, normal, localToWorld );
 }
@@ -663,6 +654,8 @@ static bool isDoom3Plane(){
        return FacePlane::m_type == eBrushTypeDoom3 || FacePlane::m_type == eBrushTypeQuake4;
 }
 
+       FacePlane& operator=(const FacePlane&) = default;
+
 class SavedState
 {
 public:
@@ -876,11 +869,8 @@ class FaceObserver
 {
 public:
 virtual void planeChanged() = 0;
-
 virtual void connectivityChanged() = 0;
-
 virtual void shaderChanged() = 0;
-
 virtual void evaluateTransform() = 0;
 };
 
@@ -1237,18 +1227,6 @@ void FitTexture( float s_repeat, float t_repeat ){
        texdefChanged();
 }
 
-void FitTextureW( float s_repeat, float t_repeat ){
-       undoSave();
-       m_texdef.fitW( m_plane.plane3().normal(), m_winding, s_repeat, t_repeat );
-       texdefChanged();
-}
-
-void FitTextureH( float s_repeat, float t_repeat ){
-       undoSave();
-       m_texdef.fitH( m_plane.plane3().normal(), m_winding, s_repeat, t_repeat );
-       texdefChanged();
-}
-
 void EmitTextureCoordinates(){
        Texdef_EmitTextureCoordinates( m_texdefTransformed, m_shader.width(), m_shader.height(), m_winding, plane3().normal(), g_matrix4_identity );
 }
@@ -1430,8 +1408,7 @@ inline bool plane3_inside( const Plane3& self, const Plane3& other, bool selfIsL
        return true;
 }
 
-typedef SmartPointer<Face> FaceSmartPointer;
-typedef std::vector<FaceSmartPointer> Faces;
+typedef std::vector<std::shared_ptr<Face>> Faces;
 
 /// \brief Returns the unique-id of the edge adjacent to \p faceVertex in the edge-pair for the set of \p faces.
 inline FaceVertexId next_edge( const Faces& faces, FaceVertexId faceVertex ){
@@ -1513,25 +1490,15 @@ class BrushObserver
 {
 public:
 virtual void reserve( std::size_t size ) = 0;
-
 virtual void clear() = 0;
-
 virtual void push_back( Face& face ) = 0;
-
 virtual void pop_back() = 0;
-
 virtual void erase( std::size_t index ) = 0;
-
 virtual void connectivityChanged() = 0;
-
 virtual void edge_clear() = 0;
-
 virtual void edge_push_back( SelectableEdge& edge ) = 0;
-
 virtual void vertex_clear() = 0;
-
 virtual void vertex_push_back( SelectableVertex& vertex ) = 0;
-
 virtual void DEBUG_verify() const = 0;
 };
 
@@ -1920,24 +1887,24 @@ bool isDetail(){
 }
 
 /// \brief Appends a copy of \p face to the end of the face list.
-Face* addFace( const Face& face ){
+       std::shared_ptr<Face> addFace( const Face& face ){
        if ( m_faces.size() == c_brush_maxFaces ) {
                return 0;
        }
        undoSave();
-       push_back( FaceSmartPointer( new Face( face, this ) ) );
+               push_back( std::make_shared<Face>( face, this ) );
        m_faces.back()->setDetail( isDetail() );
        planeChanged();
        return m_faces.back();
 }
 
 /// \brief Appends a new face constructed from the parameters to the end of the face list.
-Face* addPlane( const Vector3& p0, const Vector3& p1, const Vector3& p2, const char* shader, const TextureProjection& projection ){
+       std::shared_ptr<Face> addPlane( const Vector3& p0, const Vector3& p1, const Vector3& p2, const char* shader, const TextureProjection& projection ){
        if ( m_faces.size() == c_brush_maxFaces ) {
                return 0;
        }
        undoSave();
-       push_back( FaceSmartPointer( new Face( p0, p1, p2, shader, projection, this ) ) );
+               push_back( std::make_shared<Face>( p0, p1, p2, shader, projection, this ) );
        m_faces.back()->setDetail( isDetail() );
        planeChanged();
        return m_faces.back();
@@ -1981,11 +1948,11 @@ const_iterator end() const {
        return m_faces.end();
 }
 
-Face* back(){
+       std::shared_ptr<Face> back(){
        return m_faces.back();
 }
 
-const Face* back() const {
+       const std::shared_ptr<Face> back() const {
        return m_faces.back();
 }
 
@@ -3191,6 +3158,7 @@ TransformModifier m_transform;
 
 BrushInstance( const BrushInstance& other ); // NOT COPYABLE
 BrushInstance& operator=( const BrushInstance& other ); // NOT ASSIGNABLE
+
 public:
 static Counter* m_counter;
 
@@ -3337,6 +3305,11 @@ bool isSelected() const {
 
 void setSelected( bool select ){
        m_selectable.setSelected( select );
+       if ( !select && parent() ){
+               Selectable* sel_parent = Instance_getSelectable( *parent() );
+               if ( sel_parent && sel_parent->isSelected() )
+                       sel_parent->setSelected( false );
+       }
 }
 
 void update_selected() const {