14#ifndef AUDIOVOLUMEATTRIB_H
15#define AUDIOVOLUMEATTRIB_H
27class EXPCL_PANDA_PGRAPH AudioVolumeAttrib :
public RenderAttrib {
29 AudioVolumeAttrib(
bool off, PN_stdfloat volume);
30 INLINE AudioVolumeAttrib(
const AudioVolumeAttrib ©);
34 static CPT(RenderAttrib)
make(PN_stdfloat volume);
38 INLINE
bool is_off()
const;
41 CPT(RenderAttrib)
set_volume(PN_stdfloat volume)
const;
47 virtual void output(std::ostream &out)
const;
50 virtual int compare_to_impl(
const RenderAttrib *other)
const;
51 virtual size_t get_hash_impl()
const;
52 virtual CPT(RenderAttrib) compose_impl(
const RenderAttrib *other)
const;
53 virtual CPT(RenderAttrib) invert_compose_impl(
const RenderAttrib *other)
const;
59 static CPT(RenderAttrib) _identity_attrib;
62 static int get_class_slot() {
65 virtual int get_slot()
const {
66 return get_class_slot();
68 MAKE_PROPERTY(class_slot, get_class_slot);
71 static void register_with_read_factory();
75 static TypedWritable *make_from_bam(
const FactoryParams ¶ms);
76 void fillin(DatagramIterator &scan, BamReader *manager);
79 static TypeHandle get_class_type() {
82 static void init_type() {
83 RenderAttrib::init_type();
85 RenderAttrib::get_class_type());
86 _attrib_slot =
register_slot(_type_handle, 100,
new AudioVolumeAttrib(
false, 1));
88 virtual TypeHandle get_type()
const {
89 return get_class_type();
91 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
94 static TypeHandle _type_handle;
95 static int _attrib_slot;
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static ConstPointerTo< RenderAttrib > make_default()
Returns a RenderAttrib that corresponds to whatever the standard default properties for render attrib...
ConstPointerTo< RenderAttrib > set_volume(PN_stdfloat volume) const
Returns a new AudioVolumeAttrib, just like this one, but with the volume changed to the indicated val...
bool is_off() const
Returns true if the AudioVolumeAttrib will ignore any color scales inherited from above,...
static ConstPointerTo< RenderAttrib > make_identity()
Constructs an identity audio volume attrib.
has_volume
Returns true if the AudioVolumeAttrib has a non-identity volume, false otherwise (in which case it mi...
static ConstPointerTo< RenderAttrib > make(PN_stdfloat volume)
Constructs a new AudioVolumeAttrib object that indicates audio volume should be scaled by the indicat...
static ConstPointerTo< RenderAttrib > make_off()
Constructs a new AudioVolumeAttrib object that ignores any AudioVolumeAttrib inherited from above.
get_volume
Returns the volume to be applied to sounds.
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.
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.
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.