[go: up one dir, main page]

Menu

[f35cf5]: / media / Ac3d.h  Maximize  Restore  History

Download this file

101 lines (83 with data), 2.7 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
// Ac3d - 3D objects
//
// Copyright (C) 2003 Sam Varner
//
// This file is part of Vamos Automotive Simulator.
//
// Vamos is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Vamos is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Vamos. If not, see <http://www.gnu.org/licenses/>.
#ifndef _AC3D_H_
#define _AC3D_H_
#include "../geometry/Three_Vector.h"
#ifdef WIN32
# define WINDOWS_LEAN_AND_MEAN 1
# define NOMINMAX 1 // Do not define MS' min()/max() macros.
# include <windows.h>
#endif
#include <GL/gl.h>
#include <string>
#include <vector>
namespace Vamos_Media
{
class Ac3d_Exception
{
std::string m_message;
public:
Ac3d_Exception (std::string message) : m_message (message) {};
std::string message () const { return m_message; }
};
class No_File : public Ac3d_Exception
{
public:
No_File (std::string message) : Ac3d_Exception (message) {};
};
class Not_An_Ac3d_File : public Ac3d_Exception
{
public:
Not_An_Ac3d_File (std::string message) : Ac3d_Exception (message) {};
};
class Malformed_Ac3d_File : public Ac3d_Exception
{
public:
Malformed_Ac3d_File (std::string message) : Ac3d_Exception (message) {};
};
class Ac3d_Material;
class Ac3d_Surface;
class Ac3d_Object;
class Ac3d
{
std::string m_file;
int m_version;
std::vector <const Ac3d_Material*> m_materials;
std::vector <const Ac3d_Object*> m_objects;
double m_scale;
Vamos_Geometry::Three_Vector m_translation;
Vamos_Geometry::Three_Vector m_rotation; // angle-axis representation
void read_header (std::ifstream& is);
const Ac3d_Material* read_material (std::ifstream& is);
const Ac3d_Object* read_object (std::ifstream& is,
double scale,
const Vamos_Geometry::Three_Vector&
translation,
const Vamos_Geometry::Three_Vector&
rotation);
Ac3d_Surface* read_surface (std::ifstream& is, Ac3d_Object* obj);
public:
Ac3d (std::string file, double scale,
const Vamos_Geometry::Three_Vector& rotation,
const Vamos_Geometry::Three_Vector& translation);
~Ac3d ();
GLuint build ();
};
}
#endif // not _AC3D_H_