Get rid of unnecessary DisplayRegionBase class

This commit is contained in:
rdb 2017-05-24 13:36:01 +02:00
parent d576c6b638
commit 53794e8e36
11 changed files with 25 additions and 128 deletions

View File

@ -2371,12 +2371,9 @@
</Filter>
<Filter Name="gsgbase">
<File RelativePath="..\panda\src\gsgbase\graphicsOutputBase.cxx"></File>
<File RelativePath="..\panda\src\gsgbase\displayRegionBase.h"></File>
<File RelativePath="..\panda\src\gsgbase\displayRegionBase.I"></File>
<File RelativePath="..\panda\src\gsgbase\gsgbase_composite.cxx"></File>
<File RelativePath="..\panda\src\gsgbase\config_gsgbase.cxx"></File>
<File RelativePath="..\panda\src\gsgbase\graphicsOutputBase.I"></File>
<File RelativePath="..\panda\src\gsgbase\displayRegionBase.cxx"></File>
<File RelativePath="..\panda\src\gsgbase\gsgbase_composite1.cxx"></File>
<File RelativePath="..\panda\src\gsgbase\config_gsgbase.h"></File>
<File RelativePath="..\panda\src\gsgbase\test_gsgbase.cxx"></File>

View File

@ -883,3 +883,9 @@ INLINE int DisplayRegionPipelineReader::
get_pixel_height(int i) const {
return _cdata->_regions[i]._pixels[3] - _cdata->_regions[i]._pixels[2];
}
INLINE ostream &
operator << (ostream &out, const DisplayRegion &dr) {
dr.output(out);
return out;
}

View File

@ -16,7 +16,7 @@
#include "pandabase.h"
#include "displayRegionBase.h"
#include "typedReferenceCount.h"
#include "drawableRegion.h"
#include "referenceCount.h"
#include "nodePath.h"
@ -54,7 +54,7 @@ class CullTraverser;
* DisplayRegions like panes of glass, usually for layering 2-d interfaces on
* top of a 3-d scene.
*/
class EXPCL_PANDA_DISPLAY DisplayRegion : public DisplayRegionBase, public DrawableRegion {
class EXPCL_PANDA_DISPLAY DisplayRegion : public TypedReferenceCount, public DrawableRegion {
protected:
DisplayRegion(GraphicsOutput *window, const LVecBase4 &dimensions);
@ -285,9 +285,9 @@ public:
return _type_handle;
}
static void init_type() {
DisplayRegionBase::init_type();
TypedReferenceCount::init_type();
register_type(_type_handle, "DisplayRegion",
DisplayRegionBase::get_class_type());
TypedReferenceCount::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
@ -374,6 +374,8 @@ private:
static TypeHandle _type_handle;
};
INLINE ostream &operator << (ostream &out, const DisplayRegion &dr);
#include "displayRegion.I"
#endif /* DISPLAYREGION_H */

View File

@ -12,7 +12,6 @@
*/
#include "config_gsgbase.h"
#include "displayRegionBase.h"
#include "graphicsOutputBase.h"
#include "graphicsStateGuardianBase.h"
@ -21,7 +20,6 @@
Configure(config_gsgbase);
ConfigureFn(config_gsgbase) {
DisplayRegionBase::init_type();
GraphicsOutputBase::init_type();
GraphicsStateGuardianBase::init_type();
}

View File

@ -1,25 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file displayRegionBase.I
* @author drose
* @date 2009-02-20
*/
/**
*
*/
INLINE DisplayRegionBase::
DisplayRegionBase() {
}
INLINE ostream &
operator << (ostream &out, const DisplayRegionBase &dr) {
dr.output(out);
return out;
}

View File

@ -1,24 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file displayRegionBase.cxx
* @author drose
* @date 2009-02-20
*/
#include "displayRegionBase.h"
TypeHandle DisplayRegionBase::_type_handle;
/**
*
*/
DisplayRegionBase::
~DisplayRegionBase() {
}

View File

@ -1,57 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file displayRegionBase.h
* @author drose
* @date 2009-02-20
*/
#ifndef DISPLAYREGIONBASE_H
#define DISPLAYREGIONBASE_H
#include "pandabase.h"
#include "typedReferenceCount.h"
/**
* An abstract base class for DisplayRegion, mainly so we can store
* DisplayRegion pointers in a Camera.
*/
class EXPCL_PANDA_GSGBASE DisplayRegionBase : public TypedReferenceCount {
protected:
INLINE DisplayRegionBase();
public:
virtual ~DisplayRegionBase();
PUBLISHED:
virtual void output(ostream &out) const=0;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
TypedReferenceCount::init_type();
register_type(_type_handle, "DisplayRegionBase",
TypedReferenceCount::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
INLINE ostream &operator << (ostream &out, const DisplayRegionBase &dr);
#include "displayRegionBase.I"
#endif

View File

@ -1,6 +1,5 @@
#include "config_gsgbase.cxx"
#include "displayRegionBase.cxx"
#include "graphicsOutputBase.cxx"
#include "graphicsStateGuardianBase.cxx"

View File

@ -54,7 +54,7 @@ get_scene() const {
/**
* Returns the number of display regions associated with the camera.
*/
INLINE int Camera::
INLINE size_t Camera::
get_num_display_regions() const {
return _display_regions.size();
}
@ -62,9 +62,9 @@ get_num_display_regions() const {
/**
* Returns the nth display region associated with the camera.
*/
INLINE DisplayRegionBase *Camera::
get_display_region(int n) const {
nassertr(n >= 0 && n < (int)_display_regions.size(), (DisplayRegionBase *)NULL);
INLINE DisplayRegion *Camera::
get_display_region(size_t n) const {
nassertr(n < (int)_display_regions.size(), nullptr);
return _display_regions[n];
}

View File

@ -236,7 +236,7 @@ cleanup_aux_scene_data(Thread *current_thread) {
* camera. This is only intended to be called from the DisplayRegion.
*/
void Camera::
add_display_region(DisplayRegionBase *display_region) {
add_display_region(DisplayRegion *display_region) {
_display_regions.push_back(display_region);
}
@ -245,7 +245,7 @@ add_display_region(DisplayRegionBase *display_region) {
* by the camera. This is only intended to be called from the DisplayRegion.
*/
void Camera::
remove_display_region(DisplayRegionBase *display_region) {
remove_display_region(DisplayRegion *display_region) {
DisplayRegions::iterator dri =
find(_display_regions.begin(), _display_regions.end(), display_region);
if (dri != _display_regions.end()) {

View File

@ -25,7 +25,8 @@
#include "pointerTo.h"
#include "pmap.h"
#include "auxSceneData.h"
#include "displayRegionBase.h"
class DisplayRegion;
/**
* A node that can be positioned around in the scene graph to represent a
@ -52,8 +53,8 @@ PUBLISHED:
INLINE const NodePath &get_scene() const;
MAKE_PROPERTY(scene, get_scene, set_scene);
INLINE int get_num_display_regions() const;
INLINE DisplayRegionBase *get_display_region(int n) const;
INLINE size_t get_num_display_regions() const;
INLINE DisplayRegion *get_display_region(size_t n) const;
MAKE_SEQ(get_display_regions, get_num_display_regions, get_display_region);
MAKE_SEQ_PROPERTY(display_regions, get_num_display_regions, get_display_region);
@ -98,8 +99,8 @@ PUBLISHED:
int cleanup_aux_scene_data(Thread *current_thread = Thread::get_current_thread());
private:
void add_display_region(DisplayRegionBase *display_region);
void remove_display_region(DisplayRegionBase *display_region);
void add_display_region(DisplayRegion *display_region);
void remove_display_region(DisplayRegion *display_region);
bool _active;
NodePath _scene;
@ -110,7 +111,7 @@ private:
DrawMask _camera_mask;
PN_stdfloat _lod_scale;
typedef pvector<DisplayRegionBase *> DisplayRegions;
typedef pvector<DisplayRegion *> DisplayRegions;
DisplayRegions _display_regions;
CPT(RenderState) _initial_state;