120 lines
4.2 KiB
Plaintext
120 lines
4.2 KiB
Plaintext
// Filename: directionalLight.I
|
|
// Created by: mike (04eb99)
|
|
//
|
|
////////////////////////////////////////////////////////////////////
|
|
//
|
|
// 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."
|
|
//
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function: DirectionalLight::CData::Constructor
|
|
// Access: Public
|
|
// Description:
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE DirectionalLight::CData::
|
|
CData() :
|
|
_specular_color(1.0f, 1.0f, 1.0f, 1.0f),
|
|
_point(0.0f, 0.0f, 0.0f),
|
|
_direction(LVector3::forward())
|
|
{
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function: DirectionalLight::CData::Copy Constructor
|
|
// Access: Public
|
|
// Description:
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE DirectionalLight::CData::
|
|
CData(const DirectionalLight::CData ©) :
|
|
_specular_color(copy._specular_color),
|
|
_point(copy._point),
|
|
_direction(copy._direction)
|
|
{
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function: DirectionalLight::get_specular_color
|
|
// Access: Public
|
|
// Description: Returns the color of specular highlights generated by
|
|
// the light.
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE const LColor &DirectionalLight::
|
|
get_specular_color() const {
|
|
CDReader cdata(_cycler);
|
|
return cdata->_specular_color;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function: DirectionalLight::set_specular_color
|
|
// Access: Public
|
|
// Description: Sets the color of specular highlights generated by
|
|
// the light.
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE void DirectionalLight::
|
|
set_specular_color(const LColor &color) {
|
|
CDWriter cdata(_cycler);
|
|
cdata->_specular_color = color;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function: DirectionalLight::get_point
|
|
// Access: Public
|
|
// Description: Returns the point in space at which the light is
|
|
// located. This is local to the coordinate space in
|
|
// which the light is assigned.
|
|
//
|
|
// This actually has no bearing on the visual effect of
|
|
// the light, since the light is rendered as if it were
|
|
// infinitely far away. This is only used to create a
|
|
// visible representation of the light.
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE const LPoint3 &DirectionalLight::
|
|
get_point() const {
|
|
CDReader cdata(_cycler);
|
|
return cdata->_point;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function: DirectionalLight::set_point
|
|
// Access: Public
|
|
// Description: Sets the point in space at which the light is located.
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE void DirectionalLight::
|
|
set_point(const LPoint3 &point) {
|
|
CDWriter cdata(_cycler);
|
|
cdata->_point = point;
|
|
mark_viz_stale();
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function: DirectionalLight::get_direction
|
|
// Access: Public
|
|
// Description: Returns the direction in which the light is aimed.
|
|
// This is local to the coordinate space in which the
|
|
// light is assigned.
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE const LVector3 &DirectionalLight::
|
|
get_direction() const {
|
|
CDReader cdata(_cycler);
|
|
return cdata->_direction;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function: DirectionalLight::set_direction
|
|
// Access: Public
|
|
// Description: Sets the direction in which the light is aimed.
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE void DirectionalLight::
|
|
set_direction(const LVector3 &direction) {
|
|
CDWriter cdata(_cycler);
|
|
cdata->_direction = direction;
|
|
mark_viz_stale();
|
|
}
|