14#ifndef COLORSCALEATTRIB_H
15#define COLORSCALEATTRIB_H
27class EXPCL_PANDA_PGRAPH ColorScaleAttrib :
public RenderAttrib {
29 ColorScaleAttrib(
bool off,
const LVecBase4 &scale);
30 INLINE ColorScaleAttrib(
const ColorScaleAttrib ©);
34 static CPT(RenderAttrib)
make(
const LVecBase4 &scale);
38 INLINE
bool is_off()
const;
43 INLINE
const LVecBase4 &
get_scale()
const;
44 CPT(RenderAttrib)
set_scale(
const LVecBase4 &scale)
const;
51 virtual void output(std::ostream &out)
const;
54 virtual int compare_to_impl(
const RenderAttrib *other)
const;
55 virtual size_t get_hash_impl()
const;
56 virtual CPT(RenderAttrib) compose_impl(
const RenderAttrib *other)
const;
57 virtual CPT(RenderAttrib) invert_compose_impl(
const RenderAttrib *other)
const;
60 void quantize_scale();
66 bool _has_alpha_scale;
68 static CPT(RenderAttrib) _identity_attrib;
71 static int get_class_slot() {
74 virtual int get_slot()
const {
75 return get_class_slot();
77 MAKE_PROPERTY(class_slot, get_class_slot);
80 static void register_with_read_factory();
84 static TypedWritable *make_from_bam(
const FactoryParams ¶ms);
85 void fillin(DatagramIterator &scan, BamReader *manager);
88 static TypeHandle get_class_type() {
91 static void init_type() {
92 RenderAttrib::init_type();
94 RenderAttrib::get_class_type());
96 new ColorScaleAttrib(
false, LVecBase4(1, 1, 1, 1)));
98 virtual TypeHandle get_type()
const {
99 return get_class_type();
101 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
104 static TypeHandle _type_handle;
105 static int _attrib_slot;
bool has_alpha_scale() const
Returns true if the ColorScaleAttrib has a non-identity scale in the alpha component (ignoring RGB),...
static ConstPointerTo< RenderAttrib > make_identity()
Constructs an identity scale attrib.
static ConstPointerTo< RenderAttrib > make_off()
Constructs a new ColorScaleAttrib object that ignores any ColorScaleAttrib inherited from above.
static ConstPointerTo< RenderAttrib > make(const LVecBase4 &scale)
Constructs a new ColorScaleAttrib object that indicates geometry should be scaled by the indicated fa...
has_scale
Returns true if the ColorScaleAttrib has a non-identity scale, false otherwise (in which case it migh...
static ConstPointerTo< RenderAttrib > make_default()
Returns a RenderAttrib that corresponds to whatever the standard default properties for render attrib...
bool has_rgb_scale() const
Returns true if the ColorScaleAttrib has a non-identity scale in the RGB components (ignoring alpha),...
get_scale
Returns the scale to be applied to colors.
bool is_identity() const
Returns true if the ColorScaleAttrib is an identity attrib, false if it is either an off attrib or it...
bool is_off() const
Returns true if the ColorScaleAttrib will ignore any color scales inherited from above,...
ConstPointerTo< RenderAttrib > set_scale(const LVecBase4 &scale) const
Returns a new ColorScaleAttrib, just like this one, but with the scale changed to the indicated value...
An instance of this class is passed to the Factory when requesting it to do its business and construc...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
virtual bool lower_attrib_can_override() const
Intended to be overridden by derived RenderAttrib types to specify how two consecutive RenderAttrib o...
static int register_slot(TypeHandle type_handle, int sort, RenderAttrib *default_attrib)
Adds the indicated TypeHandle to the registry, if it is not there already, and returns a unique slot ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.