Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5865 in orxonox.OLD for trunk/src/subprojects/importer/multitex.cc


Ignore:
Timestamp:
Dec 1, 2005, 11:00:49 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: sequence test

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/subprojects/importer/multitex.cc

    r5857 r5865  
    2020#include "light.h"
    2121
     22#include "texture_sequence.h"
     23#include "material.h"
     24
    2225#include "objModel.h"
     26
    2327#include "primitive_model.h"
    2428#include <stdlib.h>
     
    2731
    2832Model* obj;
     33TextureSequence* seq;
     34Texture* test;
     35float counter = 0;
    2936
    3037void Framework::moduleInit(int argc, char** argv)
     
    3239  ResourceManager::getInstance()->addImageDir("./");
    3340
    34   for (int i = 0; i < argc; i++)
     41  seq = new TextureSequence();
     42  for (int i = 1; i < argc; i++)
    3543  {
     44    seq->addFrame(argv[i]);
    3645    printf("%s\n", argv[i]);
    3746  }
     47  test = new Texture(argv[1]);
     48
    3849  ResourceManager::getInstance()->addImageDir("");
    3950
    4051
    41   if (argc>=3)
    42     obj = new OBJModel (argv[1], atof(argv[2]));
    43   else if (argc>=2)
    44     obj = new OBJModel(argv[1]);
    45   else
    46     obj = new PrimitiveModel(PRIM_CYLINDER);
     52  obj = new PrimitiveModel(PRIM_CYLINDER);
    4753
    4854  ResourceManager::getInstance()->debug();
     
    6975void Framework::moduleTick(float dt)
    7076{
     77  counter+=dt;
    7178
     79  seq->gotoFrame((unsigned int)counter);
     80  if ((unsigned int)counter > seq->getFrameCount())
     81    counter = 0;
    7282}
    7383
    7484void Framework::moduleDraw(void) const
    7585{
     86  float diffuse[] = {1,1,1,1};
     87  float ambient[] = {1,0,0,1};
     88  float specular[] = {1,0,1,1};
     89  // setting diffuse color
     90  //  glColor3f (diffuse[0], diffuse[1], diffuse[2]);
     91  glMaterialfv(GL_FRONT, GL_DIFFUSE, diffuse);
     92
     93  // setting ambient color
     94  glMaterialfv(GL_FRONT, GL_AMBIENT, ambient);
     95
     96  // setting up Sprecular
     97  glMaterialfv(GL_FRONT, GL_SPECULAR, specular);
     98
     99  // setting up Shininess
     100  glMaterialf(GL_FRONT, GL_SHININESS, .4);
     101  glShadeModel(GL_SMOOTH);
     102
     103  glEnable(GL_TEXTURE_2D);
     104  glBindTexture(GL_TEXTURE_2D, seq->getTexture());
     105//  printf("Number = %d\n", seq->getTexture());
     106    /* This allows alpha blending of 2D textures with the scene */
     107//     if (seq->hasAlpha())
     108//     {
     109//       glEnable(GL_BLEND);
     110//       glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
     111//     }
     112
    76113  obj->draw();
    77114
Note: See TracChangeset for help on using the changeset viewer.