OpenSceneGraph 3.6.5
HighlightMapGenerator
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 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#ifndef OSGUTIL_HIGHLIGHTMAPGENERATOR_
14#define OSGUTIL_HIGHLIGHTMAPGENERATOR_
15
16#include <osgUtil/Export>
17
19
20namespace osgUtil
21{
22
29 public:
31 const osg::Vec3 &light_direction,
32 const osg::Vec4 &light_color,
33 float specular_exponent,
34 int texture_size = 64);
35
37
38 protected:
41
42 inline virtual osg::Vec4 compute_color(const osg::Vec3 &R) const;
43
44 private:
45 osg::Vec3 ldir_;
46 osg::Vec4 lcol_;
47 float sexp_;
48 };
49
50 // INLINE METHODS
51
53 {
54 float v = -ldir_ * (R / R.length());
55 if (v < 0) v = 0;
56 osg::Vec4 color(lcol_ * powf(v, sexp_));
57 color.w() = 1;
58 return color;
59 }
60
61}
62
63#endif
Vec3f Vec3
Definition Vec3:21
Vec4f Vec4
Definition Vec4:21
The osgUtil library provides general purpose utility classes such as update, cull and draw traverses,...
Definition NodeVisitor:25
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
value_type length() const
Length of the vector = sqrt( vec .
Definition Vec3f:176
value_type & w()
Definition Vec4f:90
CubeMapGenerator(int texture_size=64)
virtual ~HighlightMapGenerator()
Definition HighlightMapGenerator:39
virtual osg::Vec4 compute_color(const osg::Vec3 &R) const
Override this method to define how colors are computed.
Definition HighlightMapGenerator:52
HighlightMapGenerator & operator=(const HighlightMapGenerator &)
Definition HighlightMapGenerator:40
HighlightMapGenerator(const HighlightMapGenerator &copy, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
HighlightMapGenerator(const osg::Vec3 &light_direction, const osg::Vec4 &light_color, float specular_exponent, int texture_size=64)
#define OSGUTIL_EXPORT
Definition Export:40

osg logo
Generated at Sun Jul 27 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.