瀏覽代碼

general: clean up use of override keyword

rdb 8 年之前
父節點
當前提交
fa1c480508

+ 0 - 8
dtool/src/dtoolbase/dtoolbase_cc.h

@@ -37,7 +37,6 @@ using namespace std;
 #define ALWAYS_INLINE_CONSTEXPR constexpr
 #define NOEXCEPT noexcept
 #define FINAL final
-#define OVERRIDE override
 #define MOVE(x) x
 #define DEFAULT_CTOR = default
 #define DEFAULT_DTOR = default
@@ -167,7 +166,6 @@ template<class T> typename remove_reference<T>::type &&move(T &&t) {
 #  endif
 #  if __has_extension(cxx_override_control) && (__cplusplus >= 201103L)
 #    define FINAL final
-#    define OVERRIDE override
 #  endif
 #  if __has_extension(cxx_defaulted_functions)
 #     define DEFAULT_CTOR = default
@@ -198,7 +196,6 @@ template<class T> typename remove_reference<T>::type &&move(T &&t) {
 // Starting at GCC 4.7
 #  if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
 #    define FINAL final
-#    define OVERRIDE override
 #  endif
 
 // GCC defines several macros which we can query.  List of all supported
@@ -212,11 +209,9 @@ template<class T> typename remove_reference<T>::type &&move(T &&t) {
 #  define NOEXCEPT noexcept
 #  define USE_MOVE_SEMANTICS
 #  define FINAL final
-#  define OVERRIDE override
 #  define MOVE(x) move(x)
 #elif defined(_MSC_VER) && _MSC_VER >= 1600 // Visual Studio 2010
 #  define NOEXCEPT throw()
-#  define OVERRIDE override
 #  define USE_MOVE_SEMANTICS
 #  define FINAL sealed
 #  define MOVE(x) move(x)
@@ -245,9 +240,6 @@ template<class T> typename remove_reference<T>::type &&move(T &&t) {
 #ifndef FINAL
 #  define FINAL
 #endif
-#ifndef OVERRIDE
-#  define OVERRIDE
-#endif
 #ifndef DEFAULT_CTOR
 #  define DEFAULT_CTOR {}
 #endif

+ 5 - 5
panda/src/egg/eggLine.h

@@ -29,9 +29,9 @@ PUBLISHED:
   INLINE EggLine &operator = (const EggLine &copy);
   virtual ~EggLine();
 
-  virtual EggLine *make_copy() const OVERRIDE;
+  virtual EggLine *make_copy() const override;
 
-  virtual void write(ostream &out, int indent_level) const OVERRIDE;
+  virtual void write(ostream &out, int indent_level) const override;
 
   INLINE bool has_thick() const;
   INLINE double get_thick() const;
@@ -39,7 +39,7 @@ PUBLISHED:
   INLINE void clear_thick();
 
 protected:
-  virtual int get_num_lead_vertices() const OVERRIDE;
+  virtual int get_num_lead_vertices() const override;
 
 private:
   double _thick;
@@ -54,10 +54,10 @@ public:
     register_type(_type_handle, "EggLine",
                   EggCompositePrimitive::get_class_type());
   }
-  virtual TypeHandle get_type() const OVERRIDE {
+  virtual TypeHandle get_type() const override {
     return get_class_type();
   }
-  virtual TypeHandle force_init_type() OVERRIDE {
+  virtual TypeHandle force_init_type() override {
     init_type();
     return get_class_type();
   }

+ 4 - 4
panda/src/egg/eggNurbsCurve.h

@@ -29,7 +29,7 @@ PUBLISHED:
   INLINE EggNurbsCurve(const EggNurbsCurve &copy);
   INLINE EggNurbsCurve &operator = (const EggNurbsCurve &copy);
 
-  virtual EggNurbsCurve *make_copy() const OVERRIDE;
+  virtual EggNurbsCurve *make_copy() const override;
 
   void setup(int order, int num_knots);
 
@@ -50,7 +50,7 @@ PUBLISHED:
   INLINE double get_knot(int k) const;
   MAKE_SEQ(get_knots, get_num_knots, get_knot);
 
-  virtual void write(ostream &out, int indent_level) const OVERRIDE;
+  virtual void write(ostream &out, int indent_level) const override;
 
   MAKE_PROPERTY(order, get_order, set_order);
   MAKE_PROPERTY(degree, get_degree);
@@ -72,10 +72,10 @@ public:
     register_type(_type_handle, "EggNurbsCurve",
                   EggCurve::get_class_type());
   }
-  virtual TypeHandle get_type() const OVERRIDE {
+  virtual TypeHandle get_type() const override {
     return get_class_type();
   }
-  virtual TypeHandle force_init_type() OVERRIDE {
+  virtual TypeHandle force_init_type() override {
     init_type();
     return get_class_type();
   }

+ 5 - 5
panda/src/egg/eggNurbsSurface.h

@@ -36,7 +36,7 @@ PUBLISHED:
   INLINE EggNurbsSurface(const EggNurbsSurface &copy);
   INLINE EggNurbsSurface &operator = (const EggNurbsSurface &copy);
 
-  virtual EggNurbsSurface *make_copy() const OVERRIDE;
+  virtual EggNurbsSurface *make_copy() const override;
 
   void setup(int u_order, int v_order,
              int num_u_knots, int num_v_knots);
@@ -75,14 +75,14 @@ PUBLISHED:
   MAKE_SEQ(get_v_knots, get_num_v_knots, get_v_knot);
   INLINE EggVertex *get_cv(int ui, int vi) const;
 
-  virtual void write(ostream &out, int indent_level) const OVERRIDE;
+  virtual void write(ostream &out, int indent_level) const override;
 
 public:
   Curves _curves_on_surface;
   Trims _trims;
 
 protected:
-  virtual void r_apply_texmats(EggTextureCollection &textures) OVERRIDE;
+  virtual void r_apply_texmats(EggTextureCollection &textures) override;
 
 private:
   typedef vector_double Knots;
@@ -101,10 +101,10 @@ public:
     register_type(_type_handle, "EggNurbsSurface",
                   EggSurface::get_class_type());
   }
-  virtual TypeHandle get_type() const OVERRIDE {
+  virtual TypeHandle get_type() const override {
     return get_class_type();
   }
-  virtual TypeHandle force_init_type() OVERRIDE {
+  virtual TypeHandle force_init_type() override {
     init_type();
     return get_class_type();
   }

+ 4 - 4
panda/src/egg/eggPatch.h

@@ -28,9 +28,9 @@ PUBLISHED:
   INLINE EggPatch(const EggPatch &copy);
   INLINE EggPatch &operator = (const EggPatch &copy);
 
-  virtual EggPatch *make_copy() const OVERRIDE;
+  virtual EggPatch *make_copy() const override;
 
-  virtual void write(ostream &out, int indent_level) const OVERRIDE;
+  virtual void write(ostream &out, int indent_level) const override;
 
 public:
   static TypeHandle get_class_type() {
@@ -41,10 +41,10 @@ public:
     register_type(_type_handle, "EggPatch",
                   EggPrimitive::get_class_type());
   }
-  virtual TypeHandle get_type() const OVERRIDE {
+  virtual TypeHandle get_type() const override {
     return get_class_type();
   }
-  virtual TypeHandle force_init_type() OVERRIDE {
+  virtual TypeHandle force_init_type() override {
     init_type();
     return get_class_type();
   }

+ 5 - 5
panda/src/egg/eggPoint.h

@@ -28,7 +28,7 @@ PUBLISHED:
   INLINE EggPoint(const EggPoint &copy);
   INLINE EggPoint &operator = (const EggPoint &copy);
 
-  virtual EggPoint *make_copy() const OVERRIDE;
+  virtual EggPoint *make_copy() const override;
 
   INLINE bool has_thick() const;
   INLINE double get_thick() const;
@@ -40,9 +40,9 @@ PUBLISHED:
   INLINE void set_perspective(bool perspective);
   INLINE void clear_perspective();
 
-  virtual bool cleanup() OVERRIDE;
+  virtual bool cleanup() override;
 
-  virtual void write(ostream &out, int indent_level) const OVERRIDE;
+  virtual void write(ostream &out, int indent_level) const override;
 
 private:
   enum Flags {
@@ -64,10 +64,10 @@ public:
     register_type(_type_handle, "EggPoint",
                   EggPrimitive::get_class_type());
   }
-  virtual TypeHandle get_type() const OVERRIDE {
+  virtual TypeHandle get_type() const override {
     return get_class_type();
   }
-  virtual TypeHandle force_init_type() OVERRIDE {
+  virtual TypeHandle force_init_type() override {
     init_type();
     return get_class_type();
   }

+ 5 - 5
panda/src/egg/eggPolygon.h

@@ -27,9 +27,9 @@ PUBLISHED:
   INLINE EggPolygon(const EggPolygon &copy);
   INLINE EggPolygon &operator = (const EggPolygon &copy);
 
-  virtual EggPolygon *make_copy() const OVERRIDE;
+  virtual EggPolygon *make_copy() const override;
 
-  virtual bool cleanup() OVERRIDE;
+  virtual bool cleanup() override;
 
   bool calculate_normal(LNormald &result, CoordinateSystem cs = CS_default) const;
   bool is_planar() const;
@@ -39,7 +39,7 @@ PUBLISHED:
   INLINE bool triangulate_into(EggGroupNode *container, bool convex_also) const;
   PT(EggPolygon) triangulate_in_place(bool convex_also);
 
-  virtual void write(ostream &out, int indent_level) const OVERRIDE;
+  virtual void write(ostream &out, int indent_level) const override;
 
 private:
   bool decomp_concave(EggGroupNode *container, int asum, int x, int y) const;
@@ -55,10 +55,10 @@ public:
     register_type(_type_handle, "EggPolygon",
                   EggPrimitive::get_class_type());
   }
-  virtual TypeHandle get_type() const OVERRIDE {
+  virtual TypeHandle get_type() const override {
     return get_class_type();
   }
-  virtual TypeHandle force_init_type() OVERRIDE {
+  virtual TypeHandle force_init_type() override {
     init_type();
     return get_class_type();
   }

+ 7 - 7
panda/src/egg/eggTriangleFan.h

@@ -29,14 +29,14 @@ PUBLISHED:
   INLINE EggTriangleFan &operator = (const EggTriangleFan &copy);
   virtual ~EggTriangleFan();
 
-  virtual EggTriangleFan *make_copy() const OVERRIDE;
+  virtual EggTriangleFan *make_copy() const override;
 
-  virtual void write(ostream &out, int indent_level) const OVERRIDE;
-  virtual void apply_first_attribute() OVERRIDE;
+  virtual void write(ostream &out, int indent_level) const override;
+  virtual void apply_first_attribute() override;
 
 protected:
-  virtual int get_num_lead_vertices() const OVERRIDE;
-  virtual bool do_triangulate(EggGroupNode *container) const OVERRIDE;
+  virtual int get_num_lead_vertices() const override;
+  virtual bool do_triangulate(EggGroupNode *container) const override;
 
 public:
   static TypeHandle get_class_type() {
@@ -47,10 +47,10 @@ public:
     register_type(_type_handle, "EggTriangleFan",
                   EggCompositePrimitive::get_class_type());
   }
-  virtual TypeHandle get_type() const OVERRIDE {
+  virtual TypeHandle get_type() const override {
     return get_class_type();
   }
-  virtual TypeHandle force_init_type() OVERRIDE {
+  virtual TypeHandle force_init_type() override {
     init_type();
     return get_class_type();
   }

+ 6 - 6
panda/src/egg/eggTriangleStrip.h

@@ -29,13 +29,13 @@ PUBLISHED:
   INLINE EggTriangleStrip &operator = (const EggTriangleStrip &copy);
   virtual ~EggTriangleStrip();
 
-  virtual EggTriangleStrip *make_copy() const OVERRIDE;
+  virtual EggTriangleStrip *make_copy() const override;
 
-  virtual void write(ostream &out, int indent_level) const OVERRIDE;
+  virtual void write(ostream &out, int indent_level) const override;
 
 protected:
-  virtual int get_num_lead_vertices() const OVERRIDE;
-  virtual bool do_triangulate(EggGroupNode *container) const OVERRIDE;
+  virtual int get_num_lead_vertices() const override;
+  virtual bool do_triangulate(EggGroupNode *container) const override;
 
 public:
   static TypeHandle get_class_type() {
@@ -46,10 +46,10 @@ public:
     register_type(_type_handle, "EggTriangleStrip",
                   EggCompositePrimitive::get_class_type());
   }
-  virtual TypeHandle get_type() const OVERRIDE {
+  virtual TypeHandle get_type() const override {
     return get_class_type();
   }
-  virtual TypeHandle force_init_type() OVERRIDE {
+  virtual TypeHandle force_init_type() override {
     init_type();
     return get_class_type();
   }

+ 0 - 34
panda/src/glstuff/glCgShaderContext_src.I

@@ -10,37 +10,3 @@
  * @author rdb
  * @date 2014-06-27
  */
-
-#ifndef OPENGLES_1
-
-/**
- * Returns true if the shader is "valid", ie, if the compilation was
- * successful.  The compilation could fail if there is a syntax error in the
- * shader, or if the current video card isn't shader-capable, or if no shader
- * languages are compiled into panda.
- */
-INLINE bool CLP(CgShaderContext)::
-valid() {
-  if (_shader->get_error_flag()) return false;
-  if (_shader->get_language() != Shader::SL_Cg) return false;
-  return (_cg_program != 0);
-}
-
-/**
- * Returns true if the shader may need to access standard vertex attributes as
- * passed by glVertexPointer and the like.
- */
-INLINE bool CLP(CgShaderContext)::
-uses_standard_vertex_arrays() {
-  return false;
-}
-
-/**
- * Always true, for now.
- */
-INLINE bool CLP(CgShaderContext)::
-uses_custom_vertex_arrays() {
-  return true;
-}
-
-#endif  // OPENGLES_1

+ 14 - 0
panda/src/glstuff/glCgShaderContext_src.cxx

@@ -357,6 +357,20 @@ release_resources() {
   _glgsg->report_my_gl_errors();
 }
 
+/**
+ * Returns true if the shader is "valid", ie, if the compilation was
+ * successful.  The compilation could fail if there is a syntax error in the
+ * shader, or if the current video card isn't shader-capable, or if no shader
+ * languages are compiled into panda.
+ */
+bool CLP(CgShaderContext)::
+valid() {
+  if (_shader == nullptr || _shader->get_error_flag()) {
+    return false;
+  }
+  return (_cg_program != 0);
+}
+
 /**
  * This function is to be called to enable a new shader.  It also initializes
  * all of the shader's input parameters.

+ 13 - 13
panda/src/glstuff/glCgShaderContext_src.h

@@ -33,25 +33,25 @@ public:
   ~CLP(CgShaderContext)();
   ALLOC_DELETED_CHAIN(CLP(CgShaderContext));
 
-  INLINE bool valid(void);
-  void bind() OVERRIDE;
-  void unbind() OVERRIDE;
+  bool valid(void) override;
+  void bind() override;
+  void unbind() override;
 
   void set_state_and_transform(const RenderState *state,
                                const TransformState *modelview_transform,
                                const TransformState *camera_transform,
-                               const TransformState *projection_transform) OVERRIDE;
+                               const TransformState *projection_transform) override;
 
-  void issue_parameters(int altered) OVERRIDE;
+  void issue_parameters(int altered) override;
   void update_transform_table(const TransformTable *table);
   void update_slider_table(const SliderTable *table);
-  void disable_shader_vertex_arrays() OVERRIDE;
-  bool update_shader_vertex_arrays(ShaderContext *prev, bool force) OVERRIDE;
-  void disable_shader_texture_bindings() OVERRIDE;
-  void update_shader_texture_bindings(ShaderContext *prev) OVERRIDE;
+  void disable_shader_vertex_arrays() override;
+  bool update_shader_vertex_arrays(ShaderContext *prev, bool force) override;
+  void disable_shader_texture_bindings() override;
+  void update_shader_texture_bindings(ShaderContext *prev) override;
 
-  INLINE bool uses_standard_vertex_arrays(void);
-  INLINE bool uses_custom_vertex_arrays(void);
+  bool uses_standard_vertex_arrays(void) override { return false; }
+  bool uses_custom_vertex_arrays(void) override { return true; }
 
   // Special values for location to indicate conventional attrib slots.
   enum ConventionalAttrib {
@@ -95,10 +95,10 @@ public:
     register_type(_type_handle, CLASSPREFIX_QUOTED "CgShaderContext",
                   ShaderContext::get_class_type());
   }
-  virtual TypeHandle get_type() const OVERRIDE {
+  virtual TypeHandle get_type() const override {
     return get_class_type();
   }
-  virtual TypeHandle force_init_type() OVERRIDE {init_type(); return get_class_type();}
+  virtual TypeHandle force_init_type() override {init_type(); return get_class_type();}
 
 private:
   static TypeHandle _type_handle;

+ 0 - 35
panda/src/glstuff/glShaderContext_src.I

@@ -10,38 +10,3 @@
  * @author jyelon
  * @date 2005-09-01
  */
-
-/**
- * Returns true if the shader is "valid", ie, if the compilation was
- * successful.  The compilation could fail if there is a syntax error in the
- * shader, or if the current video card isn't shader-capable, or if no shader
- * languages are compiled into panda.
- */
-INLINE bool CLP(ShaderContext)::
-valid() {
-  if (_shader->get_error_flag()) return false;
-  if (_shader->get_language() != Shader::SL_GLSL) {
-    return false;
-  }
-  if (_glsl_program != 0) {
-    return true;
-  }
-  return false;
-}
-
-/**
- * Returns true if the shader may need to access standard vertex attributes as
- * passed by glVertexPointer and the like.
- */
-INLINE bool CLP(ShaderContext)::
-uses_standard_vertex_arrays() {
-  return _uses_standard_vertex_arrays;
-}
-
-/**
- * Always true, for now.
- */
-INLINE bool CLP(ShaderContext)::
-uses_custom_vertex_arrays() {
-  return true;
-}

+ 18 - 4
panda/src/glstuff/glShaderContext_src.cxx

@@ -1821,6 +1821,20 @@ release_resources() {
   _glgsg->report_my_gl_errors();
 }
 
+/**
+ * Returns true if the shader is "valid", ie, if the compilation was
+ * successful.  The compilation could fail if there is a syntax error in the
+ * shader, or if the current video card isn't shader-capable, or if no shader
+ * languages are compiled into panda.
+ */
+bool CLP(ShaderContext)::
+valid() {
+  if (_shader->get_error_flag()) {
+    return false;
+  }
+  return (_glsl_program != 0);
+}
+
 /**
  * This function is to be called to enable a new shader.  It also initializes
  * all of the shader's input parameters.
@@ -2177,7 +2191,7 @@ update_slider_table(const SliderTable *table) {
  */
 void CLP(ShaderContext)::
 disable_shader_vertex_arrays() {
-  if (!valid()) {
+  if (_glsl_program == 0) {
     return;
   }
 
@@ -2200,7 +2214,7 @@ disable_shader_vertex_arrays() {
  */
 bool CLP(ShaderContext)::
 update_shader_vertex_arrays(ShaderContext *prev, bool force) {
-  if (!valid()) {
+  if (_glsl_program == 0) {
     return true;
   }
 
@@ -2373,7 +2387,7 @@ update_shader_vertex_arrays(ShaderContext *prev, bool force) {
  */
 void CLP(ShaderContext)::
 disable_shader_texture_bindings() {
-  if (!valid()) {
+  if (_glsl_program == 0) {
     return;
   }
 
@@ -2473,7 +2487,7 @@ void CLP(ShaderContext)::
 update_shader_texture_bindings(ShaderContext *prev) {
   // if (prev) { prev->disable_shader_texture_bindings(); }
 
-  if (!valid()) {
+  if (_glsl_program == 0) {
     return;
   }
 

+ 19 - 15
panda/src/glstuff/glShaderContext_src.h

@@ -40,26 +40,30 @@ public:
   void reflect_uniform(int i, char *name_buffer, GLsizei name_buflen);
   bool get_sampler_texture_type(int &out, GLenum param_type);
 
-  INLINE bool valid(void);
-  void bind() OVERRIDE;
-  void unbind() OVERRIDE;
+  bool valid(void) override;
+  void bind() override;
+  void unbind() override;
 
   void set_state_and_transform(const RenderState *state,
                                const TransformState *modelview_transform,
                                const TransformState *camera_transform,
-                               const TransformState *projection_transform) OVERRIDE;
+                               const TransformState *projection_transform) override;
 
-  void issue_parameters(int altered) OVERRIDE;
+  void issue_parameters(int altered) override;
   void update_transform_table(const TransformTable *table);
   void update_slider_table(const SliderTable *table);
-  void disable_shader_vertex_arrays() OVERRIDE;
-  bool update_shader_vertex_arrays(ShaderContext *prev, bool force) OVERRIDE;
-  void disable_shader_texture_bindings() OVERRIDE;
-  void update_shader_texture_bindings(ShaderContext *prev) OVERRIDE;
-  void update_shader_buffer_bindings(ShaderContext *prev) OVERRIDE;
-
-  INLINE bool uses_standard_vertex_arrays(void);
-  INLINE bool uses_custom_vertex_arrays(void);
+  void disable_shader_vertex_arrays() override;
+  bool update_shader_vertex_arrays(ShaderContext *prev, bool force) override;
+  void disable_shader_texture_bindings() override;
+  void update_shader_texture_bindings(ShaderContext *prev) override;
+  void update_shader_buffer_bindings(ShaderContext *prev) override;
+
+  bool uses_standard_vertex_arrays(void) override {
+    return _uses_standard_vertex_arrays;
+  }
+  bool uses_custom_vertex_arrays(void) override {
+    return true;
+  }
 
 private:
   bool _validated;
@@ -128,10 +132,10 @@ public:
     register_type(_type_handle, CLASSPREFIX_QUOTED "ShaderContext",
                   ShaderContext::get_class_type());
   }
-  virtual TypeHandle get_type() const OVERRIDE {
+  virtual TypeHandle get_type() const override {
     return get_class_type();
   }
-  virtual TypeHandle force_init_type() OVERRIDE {init_type(); return get_class_type();}
+  virtual TypeHandle force_init_type() override {init_type(); return get_class_type();}
 
 private:
   static TypeHandle _type_handle;