OpenSceneGraph 3.6.5
LightSource
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSG_LIGHTSOURCE
15#define OSG_LIGHTSOURCE 1
16
17#include <osg/NodeVisitor>
18#include <osg/Light>
19#include <osg/Group>
20
21namespace osg {
22
25{
26 public:
27
29
32 const CopyOp& copyop=CopyOp::SHALLOW_COPY):
33 Group(ls,copyop),
34 _value(ls._value),
35 _light(dynamic_cast<osg::Light*>(copyop(ls._light.get()))),
37
39
45
58
60
62 void setLight(Light* light);
63
65 inline Light* getLight() { return _light.get(); }
66
68 inline const Light* getLight() const { return _light.get(); }
69
72
75
77 virtual void setThreadSafeRefUnref(bool threadSafe);
78
80
81 protected:
82
83 virtual ~LightSource();
84
87
89};
90
91}
92
93#endif
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
T * get(unsigned int contextID)
Definition ContextData:152
BoundingSphered BoundingSphere
Definition BoundingSphere:308
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Light state class which encapsulates OpenGL glLight() functionality.
Definition Light:40
META_Node(osg, LightSource)
virtual BoundingSphere computeBound() const
Compute the bounding sphere around Node's geometry or children.
void setReferenceFrame(ReferenceFrame rf)
Set the light sources's ReferenceFrame, either to be relative to its parent reference frame,...
void setLocalStateSetModes(StateAttribute::GLModeValue value=StateAttribute::ON)
Set up the local StateSet.
LightSource(const LightSource &ls, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
Definition LightSource:31
ref_ptr< Light > _light
Definition LightSource:86
void setStateSetModes(StateSet &, StateAttribute::GLModeValue) const
Set the GLModes on StateSet associated with the LightSource.
virtual void setThreadSafeRefUnref(bool threadSafe)
Set whether to use a mutex to ensure ref() and unref() are thread safe.
void setLight(Light *light)
Set the attached light.
ReferenceFrame getReferenceFrame() const
Definition LightSource:59
ReferenceFrame
Definition LightSource:41
@ ABSOLUTE_RF
Definition LightSource:43
@ RELATIVE_RF
Definition LightSource:42
const Light * getLight() const
Get the const attached light.
Definition LightSource:68
virtual ~LightSource()
StateAttribute::GLModeValue _value
Definition LightSource:85
ReferenceFrame _referenceFrame
Definition LightSource:88
Light * getLight()
Get the attached light.
Definition LightSource:65
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
@ ON
means that associated GLMode is enabled and Override is disabled.
Definition StateAttribute:103
unsigned int GLModeValue
GLModeValue is used to specify whether a mode is enabled (ON) or disabled (OFF).
Definition StateAttribute:85
Stores a set of modes and attributes which represent a set of OpenGL state.
Definition StateSet:46
#define OSG_EXPORT
Definition Export:39

osg logo
Generated at Wed Jul 23 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.