X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=radiant%2Fbrush.h;h=04d3d1ff4d4ac5193995c1be38820f70e8fbfbc7;hb=5dd408d91dd3ec430401c854fc69f2df8597ebfd;hp=8d31d3e739f1b1e29e9df264b841b3ff3896b340;hpb=3c382bc5b8276dc49fb4cbf66a6b3e83ccd13527;p=xonotic%2Fnetradiant.git diff --git a/radiant/brush.h b/radiant/brush.h index 8d31d3e7..04d3d1ff 100644 --- a/radiant/brush.h +++ b/radiant/brush.h @@ -65,8 +65,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "winding.h" #include "brush_primit.h" -#define CONTENTS_DETAIL 0x8000000 - +const unsigned int BRUSH_DETAIL_FLAG = 27; +const unsigned int BRUSH_DETAIL_MASK = (1 << BRUSH_DETAIL_FLAG); enum EBrushType { @@ -201,8 +201,6 @@ inline void Winding_Draw(const Winding& winding, const Vector3& normal, RenderSt #endif } -const Colour4b colour_vertex(0, 255, 0, 255); - #include "shaderlib.h" @@ -378,14 +376,18 @@ public: bool m_specified; }; -inline unsigned int ContentFlags_assignable(unsigned int contentFlags) -{ - return contentFlags & ~CONTENTS_DETAIL; -} - -inline ContentsFlagsValue ContentsFlagsValue_maskDetail(const ContentsFlagsValue& other) +inline void ContentsFlagsValue_assignMasked(ContentsFlagsValue& flags, const ContentsFlagsValue& other) { - return ContentsFlagsValue(other.m_surfaceFlags, ContentFlags_assignable(other.m_contentFlags), other.m_value, other.m_specified); + bool detail = bitfield_enabled(flags.m_contentFlags, BRUSH_DETAIL_MASK); + flags = other; + if(detail) + { + flags.m_contentFlags = bitfield_enable(flags.m_contentFlags, BRUSH_DETAIL_MASK); + } + else + { + flags.m_contentFlags = bitfield_disable(flags.m_contentFlags, BRUSH_DETAIL_MASK); + } } @@ -526,7 +528,7 @@ public: void setFlags(const ContentsFlagsValue& flags) { ASSERT_MESSAGE(m_realised, "FaceShader::setFlags: flags not valid when unrealised"); - m_flags = ContentsFlagsValue_maskDetail(flags); + ContentsFlagsValue_assignMasked(m_flags, flags); } Shader* state() const @@ -955,6 +957,7 @@ public: }; bool face_filtered(Face& face); +void add_face_filter(FaceFilter& filter, int mask, bool invert = false); void Brush_addTextureChangedCallback(const SignalHandler& callback); void Brush_textureChanged(); @@ -1278,6 +1281,7 @@ public: Brush_textureChanged(); m_observer->shaderChanged(); updateFiltered(); + planeChanged(); SceneChangeNotify(); } @@ -1411,18 +1415,18 @@ public: bool isDetail() const { - return (m_shader.m_flags.m_contentFlags & CONTENTS_DETAIL) != 0; + return (m_shader.m_flags.m_contentFlags & BRUSH_DETAIL_MASK) != 0; } void setDetail(bool detail) { undoSave(); if(detail && !isDetail()) { - m_shader.m_flags.m_contentFlags |= CONTENTS_DETAIL; + m_shader.m_flags.m_contentFlags |= BRUSH_DETAIL_MASK; } else if(!detail && isDetail()) { - m_shader.m_flags.m_contentFlags &= ~CONTENTS_DETAIL; + m_shader.m_flags.m_contentFlags &= ~BRUSH_DETAIL_MASK; } m_observer->shaderChanged(); } @@ -1729,10 +1733,10 @@ public: m_render_faces(m_faceCentroidPoints, GL_POINTS), m_render_vertices(m_uniqueVertexPoints, GL_POINTS), m_render_edges(m_uniqueEdgePoints, GL_POINTS), - m_planeChanged(false), - m_transformChanged(false), m_evaluateTransform(evaluateTransform), - m_boundsChanged(boundsChanged) + m_boundsChanged(boundsChanged), + m_planeChanged(false), + m_transformChanged(false) { planeChanged(); } @@ -1743,10 +1747,10 @@ public: m_render_faces(m_faceCentroidPoints, GL_POINTS), m_render_vertices(m_uniqueVertexPoints, GL_POINTS), m_render_edges(m_uniqueEdgePoints, GL_POINTS), - m_planeChanged(false), - m_transformChanged(false), m_evaluateTransform(evaluateTransform), - m_boundsChanged(boundsChanged) + m_boundsChanged(boundsChanged), + m_planeChanged(false), + m_transformChanged(false) { copy(other); } @@ -1754,6 +1758,7 @@ public: TransformNode(other), Bounded(other), Cullable(other), + Snappable(), Undoable(other), FaceObserver(other), Filterable(other), @@ -1902,6 +1907,7 @@ public: void shaderChanged() { updateFiltered(); + planeChanged(); } void evaluateBRep() const @@ -3093,7 +3099,7 @@ public: m_face->getWinding()[2].vertex ), "update_move_planepts_vertex2: error" - ) + ); m_face->m_move_planepts[0] = m_face->getWinding()[opposite].vertex; m_face->m_move_planepts[1] = m_face->getWinding()[index].vertex;