Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6507 in orxonox.OLD


Ignore:
Timestamp:
Jan 15, 2006, 3:33:54 PM (18 years ago)
Author:
hdavid
Message:

branches/avi_play: basic implementation of the world entity movie_entity

Location:
branches/avi_play/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/avi_play/src/defs/class_id.h

    r6488 r6507  
    189189  CL_GROUND_TURRET              =    0x00000244,
    190190  CL_GUIDED_MISSILE             =    0x00000245,
    191   CL_MOVIE_ENTITY               =    0x00000246,
    192191
    193192  CL_NPC_TEST1                  =    0x00000301,
    194193  CL_NPC_TEST2                  =    0x00000302,
     194  CL_MOVIE_ENTITY               =    0x00000303,
    195195
    196196
  • branches/avi_play/src/world_entities/movie_entity.cc

    r6489 r6507  
    1 
    2 
    31/*
    42   orxonox - the future of 3D-vertical-scrollers
     
    1210
    1311### File Specific:
    14    main-programmer: hdavid, stefalie
     12   main-programmer: David Hasenfratz, Stefan Lienhard
    1513   co-programmer:
    1614*/
    1715
    1816#include "movie_entity.h"
    19 #include "fast_factory.h"
     17
     18#include "media_container.h"
     19#include "load_param.h"
     20#include "factory.h"
     21#include "material.h"
     22
     23#include "network_game_manager.h"
     24#include "converter.h"
    2025
    2126using namespace std;
    2227
    23 CREATE_FAST_FACTORY_STATIC(MovieEntity, CL_MOVIE_ENTITY);
     28CREATE_FACTORY(MovieEntity, CL_MOVIE_ENTITY);
    2429
    2530/**
     
    3035  this->setClassID(CL_MOVIE_ENTITY, "MovieEntity");
    3136
     37  media_container = new MediaContainer("/home/david/Desktop/Crash.mpg");
     38
     39  this->material = new Material;
     40  this->material->setDiffuseMap("maps/radialTransparency.png");
     41
     42  this->toList(OM_COMMON);
     43
     44  this->loadParams(root);
     45
    3246  counter = 0;
    3347  timer = 0;
    34   //this->model = (Model*) ResourceManager::getInstance()->load("cube", RP_LEVEL);
     48  fps = media_container->getFPS();
    3549}
    3650
     
    4054MovieEntity::~MovieEntity ()
    4155{
     56  delete this->material;
     57  delete this->media_container;
    4258}
    4359
     60void MovieEntity::loadParams(const TiXmlElement* root)
     61{
     62  static_cast<WorldEntity*>(this)->loadParams(root);
     63}
     64
     65void MovieEntity::loadMovie(const char* filename)
     66{
     67
     68}
    4469
    4570/**
     
    5176void MovieEntity::tick(float time)
    5277{
     78  timer += time;
    5379
     80  if(counter != fps * timer)
     81  {
     82    counter = fps * timer;
     83
     84    if (counter >= media_container->getFrameCount())
     85    {
     86      timer = 0;
     87      counter = 0;
     88    }
     89  }
    5490}
    5591
     
    6399{
    64100
    65 }
     101  glPushMatrix();
     102  glTranslatef (this->getAbsCoor ().x,
     103                this->getAbsCoor ().y,
     104                this->getAbsCoor ().z);
    66105
    67 void MovieEntity::loadParams(const TiXmlElement* root)
    68 {
     106  this->material->select();
     107  glBindTexture(GL_TEXTURE_2D, media_container->getFrameTexture(counter));
     108
     109  glBegin(GL_QUADS);
     110    // Front Face
     111    glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f,  1.0f);  // Bottom Left Of The Texture and Quad
     112    glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f,  1.0f);  // Bottom Right Of The Texture and Quad
     113    glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f,  1.0f,  1.0f);  // Top Right Of The Texture and Quad
     114    glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f,  1.0f,  1.0f);  // Top Left Of The Texture and Quad
     115  glEnd();
     116
     117  glPopMatrix();
    69118
    70119}
    71 
    72 void MovieEntity::loadMovie(const char* filename)
    73 {
    74 
    75 }
    76 
  • branches/avi_play/src/world_entities/movie_entity.h

    r6489 r6507  
    88
    99#include "world_entity.h"
    10 #include "comincl.h"
    11 #include "resource_manager.h"
    1210
    1311
    1412class MediaContainer;
    15 class Model;
    1613class Material;
    17 class FastFactory;
    1814
    19 
    20 //! Basic class from which all interactive stuff in the world is derived from
    2115class MovieEntity : public WorldEntity
    2216{
    2317  private:
    24     MediaContainer*                   media_container;
    25     Model*                            model;
    26     Material*                         material;
    27 
    28     static FastFactory*               fastFactory;
     18    MediaContainer* media_container;
     19    Material* material;
    2920
    3021    int counter;
     
    4132    void loadMovie(const char* filename);
    4233
    43 
    44 
    4534};
    4635
Note: See TracChangeset for help on using the changeset viewer.