Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 6, 2005, 9:37:39 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/parenting: Importer: moved object.h → model.h and renamed it everywhere.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • orxonox/branches/parenting/src/importer/model.cc

    r3357 r3360  
    1414*/
    1515
    16 #include "object.h"
     16#include "model.h"
    1717int verbose = 1; //! \todo should be GLOBAL
    1818using namespace std;
    1919
    2020/**
    21    \brief Creates a 3D-Object, but does not load any 3D-models.
    22 
    23    This Constructor is pretty useless, because why load no object in an object-loader??
    24 */
    25 Object::Object ()
     21   \brief Creates a 3D-Model, but does not load any 3D-models.
     22
     23   This Constructor is pretty useless, because why load no model in an model-loader??
     24*/
     25Model::Model ()
    2626{
    2727
    2828  this->initialize();
    2929
    30   this->BoxObject();
     30  this->BoxModel();
    3131
    3232  this->importToGL ();
     
    3636
    3737/**
    38    \brief Crates a 3D-Object and loads in a File.
     38   \brief Crates a 3D-Model and loads in a File.
    3939   \param fileName file to parse and load (must be a .obj file)
    4040*/
    41 Object::Object(char* fileName)
     41Model::Model(char* fileName)
    4242{
    4343  this->initialize();
     
    5151
    5252/**
    53    \brief Crates a 3D-Object, loads in a File and scales it.
     53   \brief Crates a 3D-Model, loads in a File and scales it.
    5454   \param fileName file to parse and load (must be a .obj file)
    55    \param scaling The factor that the object will be scaled with.
    56 */
    57 Object::Object(char* fileName, float scaling)
     55   \param scaling The factor that the model will be scaled with.
     56*/
     57Model::Model(char* fileName, float scaling)
    5858{
    5959  this->initialize();
     
    6868
    6969/**
    70    \brief deletes an Object.
    71 
    72    Looks if any from object allocated space is still in use, and if so deleted it.
    73 */
    74 Object::~Object()
     70   \brief deletes an Model.
     71
     72   Looks if any from model allocated space is still in use, and if so deleted it.
     73*/
     74Model::~Model()
    7575{
    7676  PRINTF(2)("Deleting display Lists.\n");
     
    9797
    9898/**
    99    \brief Draws the Objects of all Groups.
     99   \brief Draws the Models of all Groups.
    100100   It does this by just calling the Lists that must have been created earlier.
    101101*/
    102 void Object::draw (void) const
    103 {
    104   PRINTF(2)("drawing the 3D-Objects\n");
     102void Model::draw (void) const
     103{
     104  PRINTF(2)("drawing the 3D-Models\n");
    105105  Group* walker = this->firstGroup;
    106106  while (walker != NULL)
    107107    {
    108       PRINTF(3)("Drawing object %s\n", walker->name);
     108      PRINTF(3)("Drawing model %s\n", walker->name);
    109109      glCallList (walker->listNumber);
    110110      walker = walker->next;
     
    113113
    114114/**
    115    \brief Draws the Object number groupNumber
     115   \brief Draws the Model number groupNumber
    116116   \param groupNumber The number of the group that will be displayed.
    117117
    118118   It does this by just calling the List that must have been created earlier.
    119119*/
    120 void Object::draw (int groupNumber) const
     120void Model::draw (int groupNumber) const
    121121{
    122122  if (groupNumber >= this->groupCount)
    123123    {
    124       PRINTF(1)("You requested object number %i, but this File only contains of %i Objects.\n", groupNumber-1, this->groupCount);
     124      PRINTF(1)("You requested model number %i, but this File only contains of %i Models.\n", groupNumber-1, this->groupCount);
    125125      return;
    126126    }
    127   PRINTF(2)("drawing the requested 3D-Objects if found.\n");
     127  PRINTF(2)("drawing the requested 3D-Models if found.\n");
    128128  Group* walker = this->firstGroup;
    129129  int counter = 0;
     
    132132      if (counter == groupNumber)
    133133        {
    134           PRINTF(2)("Drawing object number %i named %s\n", counter, walker->name);
     134          PRINTF(2)("Drawing model number %i named %s\n", counter, walker->name);
    135135          glCallList (walker->listNumber);
    136136          return;
     
    139139      walker = walker->next;
    140140    }
    141   PRINTF(1)("Object number %i in %s not Found.\n", groupNumber, this->objFileName);
     141  PRINTF(1)("Model number %i in %s not Found.\n", groupNumber, this->objFileName);
    142142  return;
    143143
     
    145145
    146146/**
    147    \brief Draws the Object with a specific groupName
     147   \brief Draws the Model with a specific groupName
    148148   \param groupName The name of the group that will be displayed.
    149149
    150150   It does this by just calling the List that must have been created earlier.
    151151*/
    152 void Object::draw (char* groupName) const
    153 {
    154   PRINTF(2)("drawing the requested 3D-Objects if found.\n");
     152void Model::draw (char* groupName) const
     153{
     154  PRINTF(2)("drawing the requested 3D-Models if found.\n");
    155155  Group* walker = this->firstGroup;
    156156  while (walker != NULL)
     
    158158      if (!strcmp(walker->name, groupName))
    159159        {
    160           PRINTF(2)("Drawing object %s\n", walker->name);
     160          PRINTF(2)("Drawing model %s\n", walker->name);
    161161          glCallList (walker->listNumber);
    162162          return;
     
    164164      walker = walker->next;
    165165    }
    166   PRINTF(1)("Object Named %s in %s not Found.\n", groupName, this->objFileName);
     166  PRINTF(1)("Model Named %s in %s not Found.\n", groupName, this->objFileName);
    167167  return;
    168168}
    169169
    170170/**
    171    \returns Count of the Objects in this File
    172 */
    173 int Object::getGroupCount (void) const
     171   \returns Count of the Models in this File
     172*/
     173int Model::getGroupCount (void) const
    174174{
    175175  return this->groupCount;
     
    177177
    178178/**
    179     \brief initializes the Object.
     179    \brief initializes the Model.
    180180
    181181    This Function initializes all the needed arrays, Lists and clientStates.
    182182    It also defines default values.
    183183*/
    184 bool Object::initialize (void)
    185 {
    186   PRINTF(2)("new 3D-Object is being created\n");
     184bool Model::initialize (void)
     185{
     186  PRINTF(2)("new 3D-Model is being created\n");
    187187
    188188  // setting the start group;
     
    206206
    207207/**
    208    \brief initializes a new Group object
     208   \brief initializes a new Group model
    209209   \param group the group that should be initialized.
    210210   \todo Maybe Group should be a Class, because it does a lot of stuff
    211211   
    212212*/
    213 bool Object::initGroup(Group* group)
     213bool Model::initGroup(Group* group)
    214214{
    215215  PRINTF(3)("Adding new Group\n");
     
    228228   \param face The face to initialize
    229229*/
    230 bool Object::initFace (Face* face)
     230bool Model::initFace (Face* face)
    231231{
    232232  face->vertexCount = 0;
     
    242242
    243243/**
    244    \brief finalizes an Object.
     244   \brief finalizes an Model.
    245245   This funcion is needed, to delete all the Lists, and arrays that are no more needed because they are already imported into openGL. This will be applied at the end of the importing Process.
    246246*/
    247 bool Object::cleanup(void)
    248 {
    249   PRINTF(3)("cleaning up the 3D-Object to save Memory.\n");
     247bool Model::cleanup(void)
     248{
     249  PRINTF(3)("cleaning up the 3D-Model to save Memory.\n");
    250250
    251251  if (this->vertices)
     
    264264   \param group the first Group to clean
    265265*/
    266 bool Object::cleanupGroup (Group* group)
     266bool Model::cleanupGroup (Group* group)
    267267{
    268268  PRINTF(3)("Cleaning up group\n");
     
    282282   \param face the first face to clean.
    283283*/
    284 bool Object::cleanupFace (Face* face)
     284bool Model::cleanupFace (Face* face)
    285285{
    286286  PRINTF(3)("Cleaning up Face\n");
     
    307307   \param faceElem the first FaceElement to clean.
    308308*/
    309 bool Object::cleanupFaceElement(FaceElement* faceElem)
     309bool Model::cleanupFaceElement(FaceElement* faceElem)
    310310{
    311311  if (faceElem->next != NULL)
     
    320320   \param fileName The file to import
    321321*/
    322 bool Object::importFile (char* fileName)
     322bool Model::importFile (char* fileName)
    323323{
    324324  PRINTF(3)("preparing to read in file: %s\n", fileName);
     
    361361   This function does read the file, parses it for the occurence of things like vertices, faces and so on, and executes the specific tasks
    362362*/
    363 bool Object::readFromObjFile (void)
     363bool Model::readFromObjFile (void)
    364364{
    365365  char* fileName = new char [strlen(objPath)+strlen(objFileName)+1];
     
    372372  if (OBJ_FILE->fail())
    373373    {
    374       PRINTF(1)("unable to open .OBJ file: %s\n Loading Box Object instead.\n", fileName);
    375       BoxObject();
     374      PRINTF(1)("unable to open .OBJ file: %s\n Loading Box Model instead.\n", fileName);
     375      BoxModel();
    376376      OBJ_FILE->close();
    377377      delete []fileName;
     
    443443
    444444   This function initializes a new Group.
    445    With it you should be able to import .obj-files with more than one Objects inside.
    446 */
    447 bool Object::readGroup (char* groupString)
     445   With it you should be able to import .obj-files with more than one Models inside.
     446*/
     447bool Model::readGroup (char* groupString)
    448448{
    449449  PRINTF(3)("Read Group: %s.\n", groupString);
     
    470470   If a vertex line is found this function will inject it into the vertex-Array
    471471*/
    472 bool Object::readVertex (char* vertexString)
     472bool Model::readVertex (char* vertexString)
    473473{
    474474  float subbuffer1;
     
    488488   The function makes a difference between QUADS and TRIANGLES, and will if changed re-open, set and re-close the gl-processe.
    489489*/
    490 bool Object::readFace (char* faceString)
     490bool Model::readFace (char* faceString)
    491491{
    492492  if (this->currentGroup->faceCount >0)
     
    551551   If a vertexNormal line is found this function will inject it into the vertexNormal-Array
    552552*/
    553 bool Object::readVertexNormal (char* normalString)
     553bool Model::readVertexNormal (char* normalString)
    554554{
    555555  float subbuffer1;
     
    569569   this function will inject it into the vertexTexture-Array
    570570*/
    571 bool Object::readVertexTexture (char* vTextureString)
     571bool Model::readVertexTexture (char* vTextureString)
    572572{
    573573  float subbuffer1;
     
    589589
    590590*/
    591 bool Object::readMtlLib (char* mtlFile)
     591bool Model::readMtlLib (char* mtlFile)
    592592{
    593593  this->mtlFileName = new char [strlen(mtlFile)+1];
     
    688688   \param matString the Material that will be set.
    689689*/
    690 bool Object::readUseMtl (char* matString)
     690bool Model::readUseMtl (char* matString)
    691691{
    692692  if (!this->mtlFileName)
     
    711711   \brief reads and includes the Faces/Materials into the openGL state Machine
    712712*/
    713 bool Object::importToGL (void)
     713bool Model::importToGL (void)
    714714{
    715715
     
    729729      if ((this->currentGroup->listNumber = glGenLists(1)) == 0)
    730730        {
    731           PRINTF(1)("list could not be created for this Object\n");
     731          PRINTF(1)("list could not be created for this Model\n");
    732732          return false;
    733733        }
     
    810810   merging this information, the face will be drawn.
    811811*/
    812 bool Object::addGLElement (FaceElement* elem)
     812bool Model::addGLElement (FaceElement* elem)
    813813{
    814814  PRINTF(3)("importing grafical Element to openGL.\n");
     
    832832   4. It goes through all the normale-Points and calculates the VertexNormale and includes it in the normals-Array.
    833833*/
    834 bool Object::buildVertexNormals ()
     834bool Model::buildVertexNormals ()
    835835{
    836836 
     
    903903
    904904/**
    905    \brief Includes a default object
    906 
    907    This will inject a Cube, because this is the most basic object.
    908 */
    909 void Object::BoxObject(void)
     905   \brief Includes a default model
     906
     907   This will inject a Cube, because this is the most basic model.
     908*/
     909void Model::BoxModel(void)
    910910{
    911911  this->readVertex ("-0.5 -0.5 0.5");
Note: See TracChangeset for help on using the changeset viewer.