53
53
static T *UpCastResource (U *Src)
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);
181
181
BaseTexture *CreateTextureFromFile (const TCHAR *TextureFilename)
183
NBitmapData *BitmapData = LoadImageFile (TextureFilename);
183
BaseTexture* texture = nullptr;
185
NBitmapData* BitmapData = LoadImageFile (TextureFilename);
184
186
NUX_RETURN_VALUE_IF_NULL (BitmapData, 0);
186
188
if (BitmapData->IsTextureData() )
188
BaseTexture *texture = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableTexture();
189
texture->Update (BitmapData);
190
texture = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableTexture();
192
192
else if (BitmapData->IsCubemapTextureData() )
194
TextureCube *texture = new TextureCube();
195
texture->Update (BitmapData);
194
texture = new TextureCube();
198
196
else if (BitmapData->IsVolumeTextureData() )
200
TextureVolume *texture = new TextureVolume();
201
texture->Update (BitmapData);
198
texture = new TextureVolume();
204
200
else if (BitmapData->IsAnimatedTextureData() )
206
TextureFrameAnimation *texture = new TextureFrameAnimation();
207
texture->Update (BitmapData);
202
texture = new TextureFrameAnimation();
207
texture->Update(BitmapData);
211
nuxDebugMsg ("[CreateTextureFromFile] Invalid texture format type for file (%s)", TextureFilename);
211
214
delete BitmapData;
212
nuxDebugMsg ("[CreateTextureFromFile] Invalid texture format type for file (%s)", TextureFilename);
216
218
BaseTexture *CreateTextureFromBitmapData (const NBitmapData *BitmapData)
270
272
Texture2D::Texture2D(NUX_FILE_LINE_DECL)
273
: BaseTexture(NUX_FILE_LINE_PARAM)
274
277
Texture2D::Texture2D (const Texture2D &texture, NUX_FILE_LINE_DECL)
278
: BaseTexture(NUX_FILE_LINE_PARAM)
276
280
_image = texture._image;
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)
281
_image = BaseTexture;
286
_image = texture_data;
284
289
Texture2D &Texture2D::operator = (const Texture2D &texture)