~ubuntu-branches/ubuntu/oneiric/nux/oneiric

« back to all changes in this revision

Viewing changes to NuxGraphics/GLTextureResourceManager.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2011-08-25 13:42:45 UTC
  • mfrom: (1.1.27 upstream)
  • Revision ID: james.westby@ubuntu.com-20110825134245-edi1g8cm2iqibae7
Tags: 1.4.0-0ubuntu1
* New upstream version:
  - "scrolling down in a lens brings it back to the top automatically" 
    (lp: #821534)
* debian/rules: updated shlib

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
  static T *UpCastResource (U *Src)
54
54
  {
55
55
    if (!Src || !Src->Type().IsDerivedFromType (T::StaticObjectType))
56
 
      nuxError (TEXT ("[UpCastResource] Cast of %s to %s failed"), U::StaticObjectType.m_Name, T::StaticObjectType.m_Name);
 
56
      nuxError (TEXT ("[UpCastResource] Cast of %s to %s failed"), U::StaticObjectType.name, T::StaticObjectType.name);
57
57
 
58
58
    return (T *) Src;
59
59
  }
180
180
 
181
181
  BaseTexture *CreateTextureFromFile (const TCHAR *TextureFilename)
182
182
  {
183
 
    NBitmapData *BitmapData = LoadImageFile (TextureFilename);
 
183
    BaseTexture* texture = nullptr;
 
184
 
 
185
    NBitmapData* BitmapData = LoadImageFile (TextureFilename);
184
186
    NUX_RETURN_VALUE_IF_NULL (BitmapData, 0);
185
187
 
186
188
    if (BitmapData->IsTextureData() )
187
189
    {
188
 
      BaseTexture *texture = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableTexture();
189
 
      texture->Update (BitmapData);
190
 
      return texture;
 
190
      texture = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableTexture();
191
191
    }
192
192
    else if (BitmapData->IsCubemapTextureData() )
193
193
    {
194
 
      TextureCube *texture = new TextureCube();
195
 
      texture->Update (BitmapData);
196
 
      return texture;
 
194
      texture = new TextureCube();
197
195
    }
198
196
    else if (BitmapData->IsVolumeTextureData() )
199
197
    {
200
 
      TextureVolume *texture = new TextureVolume();
201
 
      texture->Update (BitmapData);
202
 
      return texture;
 
198
      texture = new TextureVolume();
203
199
    }
204
200
    else if (BitmapData->IsAnimatedTextureData() )
205
201
    {
206
 
      TextureFrameAnimation *texture = new TextureFrameAnimation();
207
 
      texture->Update (BitmapData);
208
 
      return texture;
 
202
      texture = new TextureFrameAnimation();
 
203
    }
 
204
 
 
205
    if (texture)
 
206
    {
 
207
      texture->Update(BitmapData);
 
208
    }
 
209
    else
 
210
    {
 
211
      nuxDebugMsg ("[CreateTextureFromFile] Invalid texture format type for file (%s)", TextureFilename);
209
212
    }
210
213
 
211
214
    delete BitmapData;
212
 
    nuxDebugMsg ("[CreateTextureFromFile] Invalid texture format type for file (%s)", TextureFilename);
213
 
    return 0;
 
215
    return texture;
214
216
  }
215
217
 
216
218
  BaseTexture *CreateTextureFromBitmapData (const NBitmapData *BitmapData)
268
270
  }
269
271
 
270
272
  Texture2D::Texture2D(NUX_FILE_LINE_DECL)
 
273
    : BaseTexture(NUX_FILE_LINE_PARAM)
271
274
  {
272
275
  }
273
276
 
274
277
  Texture2D::Texture2D (const Texture2D &texture, NUX_FILE_LINE_DECL)
 
278
    : BaseTexture(NUX_FILE_LINE_PARAM)
275
279
  {
276
280
    _image = texture._image;
277
281
  }
278
282
 
279
 
  Texture2D::Texture2D (const NTextureData &BaseTexture, NUX_FILE_LINE_DECL)
 
283
  Texture2D::Texture2D (const NTextureData &texture_data, NUX_FILE_LINE_DECL)
 
284
    : BaseTexture(NUX_FILE_LINE_PARAM)
280
285
  {
281
 
    _image = BaseTexture;
 
286
    _image = texture_data;
282
287
  }
283
288
 
284
289
  Texture2D &Texture2D::operator = (const Texture2D &texture)