1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
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.
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.
13#ifndef OSGUTIL_REFLECTIONMAPGENERATOR_
14#define OSGUTIL_REFLECTIONMAPGENERATOR_
16#include <osgUtil/CubeMapGenerator>
21 /** This is the most simple cube map generator. It performs a direct association
22 between reflection vector and RGBA color (C = R).
24 class ReflectionMapGenerator: public CubeMapGenerator {
26 inline ReflectionMapGenerator(int texture_size = 64);
27 inline ReflectionMapGenerator(const ReflectionMapGenerator ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
30 virtual ~ReflectionMapGenerator() {}
31 ReflectionMapGenerator &operator=(const ReflectionMapGenerator &) { return *this; }
33 inline virtual osg::Vec4 compute_color(const osg::Vec3 &R) const;
38 inline ReflectionMapGenerator::ReflectionMapGenerator(int texture_size)
39 : CubeMapGenerator(texture_size)
43 inline ReflectionMapGenerator::ReflectionMapGenerator(const ReflectionMapGenerator ©, const osg::CopyOp ©op)
44 : CubeMapGenerator(copy, copyop)
48 inline osg::Vec4 ReflectionMapGenerator::compute_color(const osg::Vec3 &R) const
50 return vector_to_color(R / R.length());