最新osg包

源代码在线查看: object.h

软件大小: 5430 K
上传用户: xxjjyy1237
关键词: osg
下载地址: 免注册下载 普通下载 VIP

相关代码

				/*******************************************************				      Lightwave Object Loader for OSG								  Copyright (C) 2004 Marco Jez 				  OpenSceneGraph is (C) 2004 Robert Osfield				********************************************************/								#ifndef LWOSG_OBJECT_				#define LWOSG_OBJECT_								#include "Layer.h"				#include "Surface.h"				#include "Clip.h"				#include "Unit.h"								#include "iffparser.h"								#include 				#include 								#include 				#include 				#include 								namespace lwosg				{									class CoordinateSystemFixer: public osg::Referenced {					public:						virtual osg::Vec3 fix_point(const osg::Vec3 &P) const = 0;						virtual osg::Vec4 fix_point(const osg::Vec4 &P) const = 0;						virtual osg::Vec3 fix_vector(const osg::Vec3 &V) const = 0;						virtual osg::Vec4 fix_vector(const osg::Vec4 &V) const = 0;						virtual inline bool invert_winding() const { return false; }									protected:						virtual ~CoordinateSystemFixer() {}						CoordinateSystemFixer &operator=(const CoordinateSystemFixer &) { return *this; }					};									class LwoCoordFixer: public CoordinateSystemFixer {					public:						inline osg::Vec3 fix_point(const osg::Vec3 &P) const;						inline osg::Vec4 fix_point(const osg::Vec4 &P) const;						inline osg::Vec3 fix_vector(const osg::Vec3 &V) const;						inline osg::Vec4 fix_vector(const osg::Vec4 &V) const;						inline bool invert_winding() const { return true; }									protected:						virtual ~LwoCoordFixer() {}						LwoCoordFixer &operator=(const LwoCoordFixer &) { return *this; }					};																	class Object {					public:										typedef std::map Layer_map;						typedef std::map Surface_map;										Object();						Object(const iff::Chunk_list &data);										inline CoordinateSystemFixer *get_coordinate_system_fixer() { return csf_.get(); }						inline const CoordinateSystemFixer *get_coordinate_system_fixer() const { return csf_.get(); }						inline void set_coordinate_system_fixer(CoordinateSystemFixer *csf) { csf_ = csf; }										void build(const iff::Chunk_list &data);										inline Layer_map &layers() { return layers_; }						inline const Layer_map &layers() const { return layers_; }										inline Surface_map &surfaces() { return surfaces_; }						inline const Surface_map &surfaces() const { return surfaces_; }										inline const std::string &get_comment() const { return comment_; }						inline const std::string &get_description() const { return description_; }									protected:						void scan_clips(const iff::Chunk_list &data);						void scan_surfaces(const iff::Chunk_list &data);						void parse(const iff::Chunk_list &data);										void generate_normals();						void generate_auto_texture_maps();									private:								Layer_map layers_;										typedef std::map Clip_map;						Clip_map clips_;										Surface_map surfaces_;										std::string comment_;						std::string description_;										osg::ref_ptr csf_;					};									// INLINE METHODS									inline osg::Vec3 LwoCoordFixer::fix_point(const osg::Vec3 &P) const					{						return osg::Vec3(P.x(), P.z(), P.y());					}									inline osg::Vec4 LwoCoordFixer::fix_point(const osg::Vec4 &P) const					{						return osg::Vec4(fix_point(osg::Vec3(P.x(), P.y(), P.z())), P.w());					}									inline osg::Vec3 LwoCoordFixer::fix_vector(const osg::Vec3 &V) const					{						return fix_point(V);					}									inline osg::Vec4 LwoCoordFixer::fix_vector(const osg::Vec4 &V) const					{						return fix_point(V);					}								}								#endif							

相关资源