Changeset 13041 for OpenSceneGraph/trunk/include/osgUtil/CubeMapGenerator
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osgUtil/CubeMapGenerator
r5328 r13041 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 2 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 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 5 * (at your option) any later version. The full license is in LICENSE file 6 6 * included with this distribution, and on the openscenegraph.org website. 7 * 7 * 8 8 * This library is distributed in the hope that it will be useful, 9 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 11 * OpenSceneGraph Public License for more details. 12 12 */ … … 29 29 { 30 30 31 /** This is the base class for cube map generators. 31 /** This is the base class for cube map generators. 32 32 It exposes the necessary interface to access the six generated images; 33 33 descendants should only override the compute_color() method. … … 41 41 inline const osg::Image *getImage(osg::TextureCubeMap::Face face) const; 42 42 43 /** Generate the six cube images. 44 If use_osg_system is true, then the OSG's coordinate system is used instead 43 /** Generate the six cube images. 44 If use_osg_system is true, then the OSG's coordinate system is used instead 45 45 of the default OpenGL one. 46 46 */ … … 52 52 53 53 inline void set_pixel(int index, int c, int r, const osg::Vec4 &color); 54 inline static osg::Vec4 vector_to_color(const osg::Vec3 &vec); 54 inline static osg::Vec4 vector_to_color(const osg::Vec3 &vec); 55 55 56 /** Override this method to define how colors are computed. 56 /** Override this method to define how colors are computed. 57 57 The parameter R is the reflection vector, pointing from the center of the cube. 58 58 The return value should be the RGBA color associated with that reflection ray. … … 64 64 65 65 typedef std::vector<osg::ref_ptr<osg::Image> > Image_list; 66 Image_list images_; 66 Image_list images_; 67 67 }; 68 68 … … 77 77 case osg::TextureCubeMap::NEGATIVE_Y: return images_[3].get(); 78 78 case osg::TextureCubeMap::POSITIVE_Z: return images_[4].get(); 79 case osg::TextureCubeMap::NEGATIVE_Z: return images_[5].get(); 79 case osg::TextureCubeMap::NEGATIVE_Z: return images_[5].get(); 80 80 default: return 0; 81 81 } … … 90 90 case osg::TextureCubeMap::NEGATIVE_Y: return images_[3].get(); 91 91 case osg::TextureCubeMap::POSITIVE_Z: return images_[4].get(); 92 case osg::TextureCubeMap::NEGATIVE_Z: return images_[5].get(); 92 case osg::TextureCubeMap::NEGATIVE_Z: return images_[5].get(); 93 93 default: return 0; 94 94 } … … 102 102 *(i->data(c, r)+1) = static_cast<unsigned char>(osg::clampBetween(color.y(),0.0f,1.0f) * 255); 103 103 *(i->data(c, r)+2) = static_cast<unsigned char>(osg::clampBetween(color.z(),0.0f,1.0f) * 255); 104 *(i->data(c, r)+3) = static_cast<unsigned char>(osg::clampBetween(color.w(),0.0f,1.0f) * 255); 104 *(i->data(c, r)+3) = static_cast<unsigned char>(osg::clampBetween(color.w(),0.0f,1.0f) * 255); 105 105 } else { 106 106 osg::notify(osg::WARN) << "Warning: CubeMapGenerator::set_pixel(): invalid image index\n";
