Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7195 in orxonox.OLD for trunk/src


Ignore:
Timestamp:
Mar 7, 2006, 11:12:31 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: performance issues

Location:
trunk/src/lib
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/importer/texture_sequence.h

    r7194 r7195  
    99#include "texture.h"
    1010
    11 #include "glincl.h"
    12 
    1311#include <vector>
    1412#include <stdarg.h>
    1513
    16 /* Forward Declaration */
    17 struct SDL_Surface;
    1814
    1915//! A Class, that reads in Textures from different fileformats.
  • trunk/src/lib/graphics/shader.h

    r7164 r7195  
    4242  static bool checkShaderAbility();
    4343
    44   inline static bool shaderActive() { return (Shader::storedShader != NULL)?true:false; };
     44  inline static bool shaderActive() { return (Shader::storedShader != NULL)? true : false; };
    4545  inline static Shader* getActiveShader() { return Shader::storedShader; };
    4646  inline static void suspendShader() { Shader* currShader = storedShader; if (storedShader!= NULL) { Shader::deactivateShader(); Shader::storedShader = currShader;} };
  • trunk/src/lib/util/color.cc

    r5494 r7195  
    1717
    1818#include "color.h"
    19 #include "vector.h"
     19#include <stdio.h>
    2020
    2121using namespace std;
    2222
    2323
    24 
    25 
    26 #include <stdio.h>
    27 
    2824/**
    29  * transforms from RGB to HSVtoRGB
    30  * @param RGB the RGB-color [0-1]
     25 * @brief transforms from RGB to HSVtoRGB
     26 * @param RGB: the RGB-color [0-1]
    3127 * @returns HSV: with values (h[0-360(degree)],s[0,1],v[0,1])
    3228 */
    3329Vector Color::RGBtoHSV(const Vector& RGB)
     30{
     31  Vector HSV;
     32  RGBtoHSV(RGB, HSV);
     33  return HSV;
     34}
     35
     36/**
     37 * @brief transforms from RGB to HSVtoRGB
     38 * @param RGB: the RGB-color [0-1]
     39 * @param HSV: with values (h[0-360(degree)],s[0,1],v[0,1])
     40 */
     41void Color::RGBtoHSV(const Vector& RGB, Vector& HSV)
    3442{
    3543  float r = RGB.x;
     
    7078      h += 360.0;
    7179  }
    72   return Vector(h, s, v);
     80  HSV = Vector(h, s, v);
    7381}
    7482
    7583/**
    76  * converts a Color from HSV to RGBtoHSV
     84 * @brief converts a Color from HSV to RGBtoHSV
    7785 * @param HSV: Vector with values (h[0-360(degree)],s[0,1],v[0,1])
    7886 * @returns RGB: Vector [0-1]
    7987 */
    8088Vector Color::HSVtoRGB(const Vector& HSV)
     89{
     90  Vector RGB;
     91  HSVtoRGB(HSV, RGB);
     92  return RGB;
     93}
     94
     95/**
     96 * @brief converts a Color from HSV to RGBtoHSV
     97 * @param HSV: Vector with values (h[0-360(degree)],s[0,1],v[0,1])
     98 * @param RGB: Vector [0-1]
     99 */
     100void Color::HSVtoRGB(const Vector& HSV, Vector& RGB)
    81101{
    82102  float h = HSV.x;
     
    141161    }
    142162  }
    143   return Vector(r,g,b);
     163  RGB = Vector(r,g,b);
    144164}
    145165
  • trunk/src/lib/util/color.h

    r5011 r7195  
    1010#define _COLOR_H
    1111
    12 //#include "vector.h"
    13 class Vector;
     12#include "vector.h"
    1413
    1514//! a very abstract Class that helps transforming Colors into different Systems
    1615class Color
    1716{
    18   public:
     17public:
    1918  static Vector RGBtoHSV (const Vector& RGB);
     19  static void RGBtoHSV (const Vector& RGB, Vector& HSV);
    2020  static Vector HSVtoRGB (const Vector& HSV);
     21  static void HSVtoRGB (const Vector& HSV, Vector& RGB);
    2122
     23private:
    2224  static float minrgb(float r, float g, float b);
    2325  static float maxrgb(float r, float g, float b);
  • trunk/src/lib/util/loading/resource.cc

    r7193 r7195  
    1010
    1111   ### File Specific:
    12    main-programmer: ...
     12   main-programmer: Benjamin Grauer
    1313   co-programmer: ...
    1414*/
    1515
    16 //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
     16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LOADING
    1717
    1818#include "resource.h"
     
    2323/**
    2424 * standard constructor
    25  * @todo this constructor is not jet implemented - do it
    2625*/
    27 Resource::Resource ()
     26Resource::Resource (const std::string& fileName)
    2827{
    2928   this->setClassID(CL_RESOURCE, "Resource");
    3029
    31    /* If you make a new class, what is most probably the case when you write this file
    32       don't forget to:
    33        1. Add the new file new_class.cc to the ./src/Makefile.am
    34        2. Add the class identifier to ./src/class_id.h eg. CL_NEW_CLASS
    35 
    36       Advanced Topics:
    37       - if you want to let your object be managed via the ObjectManager make sure to read
    38         the object_manager.h header comments. You will use this most certanly only if you
    39         make many objects of your class, like a weapon bullet.
    40    */
    4130}
    42 
    4331
    4432/**
    4533 * standard deconstructor
    46 */
     34 */
    4735Resource::~Resource ()
    4836{
  • trunk/src/lib/util/loading/resource.h

    r7193 r7195  
    11/*!
    22 * @file resource.h
    3  * @brief Definition of ...
     3 * @brief Definition of a Resource.
    44*/
    55
     
    99#include "base_object.h"
    1010#include "multi_type.h"
    11 
     11#include <string>
    1212
    1313// FORWARD DECLARATION
     
    1515
    1616
    17 //! A class for ...
     17//! An enumerator for different (UN)LOAD-types.
     18/**
     19 * RP_NO:        will be unloaded on request
     20 * RP_LEVEL:     will be unloaded at the end of a Level
     21 * RP_CAMPAIGN:  will be unloaded at the end of a Campaign
     22 * RP_GAME:      will be unloaded at the end of the whole Game (when closing orxonox)
     23 */
     24typedef enum ResourcePriority
     25{
     26  RP_NO        =   0,
     27  RP_LEVEL     =   1,
     28  RP_CAMPAIGN  =   2,
     29  RP_GAME      =   3
     30};
     31
     32
     33
     34//! A Resource is an Object, that can be loaded from Disk
     35/**
     36 *
     37 */
    1838class Resource : virtual public BaseObject {
    1939
    2040 public:
    21   Resource();
     41   Resource(const std::string& fileName);
    2242  virtual ~Resource();
    2343
    24   virtual bool load(const char* fileName, const MultiType& param1, const MultiType& param2);
     44  virtual bool load(std::string& fileName, const MultiType& param1, const MultiType& param2);
    2545  virtual bool reload();
    2646  virtual bool unload();
    2747
    2848 private:
     49   std::string       fileName;
    2950
     51   unsigned int      referenceCount;    //!< How many times this Resource has been loaded.
     52/// TODO REMOVE THIS:   ResourceType      type;              //!< ResourceType of this Resource.
     53   ResourcePriority  prio;              //!< The Priority of this resource. (can only be increased, so noone else will delete this)
     54
     55   MultiType         param[3];          //!< The Parameters given to this Resource.
    3056};
    3157
Note: See TracChangeset for help on using the changeset viewer.