mirror of
https://github.com/glest/glest-source.git
synced 2025-08-23 08:22:50 +02:00
Patch from PolitikerNEU for RGB / RGBA files
This commit is contained in:
@@ -217,6 +217,7 @@ public:
|
|||||||
Pixmap3D(int d, int components);
|
Pixmap3D(int d, int components);
|
||||||
void init(int w, int h, int d, int components);
|
void init(int w, int h, int d, int components);
|
||||||
void init(int d, int components);
|
void init(int d, int components);
|
||||||
|
void init(int components);
|
||||||
~Pixmap3D();
|
~Pixmap3D();
|
||||||
|
|
||||||
//load & save
|
//load & save
|
||||||
@@ -253,6 +254,7 @@ protected:
|
|||||||
public:
|
public:
|
||||||
//init
|
//init
|
||||||
void init(int w, int h, int components);
|
void init(int w, int h, int components);
|
||||||
|
void init(int components);
|
||||||
|
|
||||||
//load & save
|
//load & save
|
||||||
void loadFace(const string &path, int face);
|
void loadFace(const string &path, int face);
|
||||||
|
145
source/shared_lib/include/graphics/texture.h
Normal file
145
source/shared_lib/include/graphics/texture.h
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
// ==============================================================
|
||||||
|
// This file is part of Glest Shared Library (www.glest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001-2008 Marti<74>o Figueroa
|
||||||
|
//
|
||||||
|
// You can redistribute this code and/or modify it under
|
||||||
|
// the terms of the GNU General Public License as published
|
||||||
|
// by the Free Software Foundation; either version 2 of the
|
||||||
|
// License, or (at your option) any later version
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _SHARED_GRAPHICS_TEXTURE_H_
|
||||||
|
#define _SHARED_GRAPHICS_TEXTURE_H_
|
||||||
|
|
||||||
|
#include "types.h"
|
||||||
|
#include "pixmap.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
using std::string;
|
||||||
|
using Shared::Platform::uint8;
|
||||||
|
|
||||||
|
namespace Shared{ namespace Graphics{
|
||||||
|
|
||||||
|
class TextureParams;
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class Texture
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class Texture{
|
||||||
|
public:
|
||||||
|
static const int defaultSize;
|
||||||
|
static const int defaultComponents;
|
||||||
|
|
||||||
|
enum WrapMode{
|
||||||
|
wmRepeat,
|
||||||
|
wmClamp,
|
||||||
|
wmClampToEdge
|
||||||
|
};
|
||||||
|
|
||||||
|
enum Filter{
|
||||||
|
fBilinear,
|
||||||
|
fTrilinear
|
||||||
|
};
|
||||||
|
|
||||||
|
enum Format{
|
||||||
|
fAuto,
|
||||||
|
fAlpha,
|
||||||
|
fLuminance,
|
||||||
|
fRgb,
|
||||||
|
fRgba
|
||||||
|
};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
string path;
|
||||||
|
bool mipmap;
|
||||||
|
WrapMode wrapMode;
|
||||||
|
bool pixmapInit;
|
||||||
|
Format format;
|
||||||
|
|
||||||
|
bool inited;
|
||||||
|
|
||||||
|
public:
|
||||||
|
Texture();
|
||||||
|
virtual ~Texture(){};
|
||||||
|
|
||||||
|
bool getMipmap() const {return mipmap;}
|
||||||
|
WrapMode getWrapMode() const {return wrapMode;}
|
||||||
|
bool getPixmapInit() const {return pixmapInit;}
|
||||||
|
Format getFormat() const {return format;}
|
||||||
|
const string getPath() const {return path;}
|
||||||
|
|
||||||
|
void setMipmap(bool mipmap) {this->mipmap= mipmap;}
|
||||||
|
void setWrapMode(WrapMode wrapMode) {this->wrapMode= wrapMode;}
|
||||||
|
void setPixmapInit(bool pixmapInit) {this->pixmapInit= pixmapInit;}
|
||||||
|
void setFormat(Format format) {this->format= format;}
|
||||||
|
|
||||||
|
virtual void init(Filter filter= fBilinear, int maxAnisotropy= 1)=0;
|
||||||
|
virtual void end()=0;
|
||||||
|
};
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class Texture1D
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class Texture1D: public Texture{
|
||||||
|
protected:
|
||||||
|
Pixmap1D pixmap;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void load(const string &path);
|
||||||
|
|
||||||
|
Pixmap1D *getPixmap() {return &pixmap;}
|
||||||
|
const Pixmap1D *getPixmap() const {return &pixmap;}
|
||||||
|
};
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class Texture2D
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class Texture2D: public Texture{
|
||||||
|
protected:
|
||||||
|
Pixmap2D pixmap;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void load(const string &path);
|
||||||
|
|
||||||
|
Pixmap2D *getPixmap() {return &pixmap;}
|
||||||
|
const Pixmap2D *getPixmap() const {return &pixmap;}
|
||||||
|
};
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class Texture3D
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class Texture3D: public Texture{
|
||||||
|
protected:
|
||||||
|
Pixmap3D pixmap;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void loadSlice(const string &path, int slice);
|
||||||
|
|
||||||
|
Pixmap3D *getPixmap() {return &pixmap;}
|
||||||
|
const Pixmap3D *getPixmap() const {return &pixmap;}
|
||||||
|
};
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class TextureCube
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class TextureCube: public Texture{
|
||||||
|
protected:
|
||||||
|
PixmapCube pixmap;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void loadFace(const string &path, int face);
|
||||||
|
|
||||||
|
PixmapCube *getPixmap() {return &pixmap;}
|
||||||
|
const PixmapCube *getPixmap() const {return &pixmap;}
|
||||||
|
};
|
||||||
|
|
||||||
|
}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
@@ -81,34 +81,58 @@ Pixmap2D* BMPReader::read(ifstream& in, const string& path, Pixmap2D* ret) const
|
|||||||
int h= infoHeader.height;
|
int h= infoHeader.height;
|
||||||
int w= infoHeader.width;
|
int w= infoHeader.width;
|
||||||
int components= (ret->getComponents() == -1)?3:ret->getComponents();
|
int components= (ret->getComponents() == -1)?3:ret->getComponents();
|
||||||
|
const int fileComponents = 3;
|
||||||
//std::cout << "BMP-Components: Pic: " << components << " old: " << (ret->getComponents()) << " File: " << 3 << std::endl;
|
//std::cout << "BMP-Components: Pic: " << components << " old: " << (ret->getComponents()) << " File: " << 3 << std::endl;
|
||||||
ret->init(w,h,components);
|
ret->init(w,h,components);
|
||||||
uint8* pixels = ret->getPixels();
|
uint8* pixels = ret->getPixels();
|
||||||
for(int i=0; i<h*w*components; i+=components){
|
char buffer[4];
|
||||||
uint8 r, g, b;
|
//BMP is padded to sizes of 4
|
||||||
in.read((char*)&b, 1);
|
const int padSize = (4 - (w*fileComponents)%4)%4; //Yeah, could be faster
|
||||||
in.read((char*)&g, 1);
|
//std::cout << "Padsize = " << padSize;
|
||||||
in.read((char*)&r, 1);
|
for (int y = 0, i = 0; y < h; ++y) {
|
||||||
if (!in.good()) {
|
for (int x = 0; x < w; ++x, i+=components) {
|
||||||
return NULL;
|
uint8 r, g, b;
|
||||||
|
in.read((char*)&b, 1);
|
||||||
|
in.read((char*)&g, 1);
|
||||||
|
in.read((char*)&r, 1);
|
||||||
|
if (!in.good()) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
switch(components){
|
||||||
|
case 1:
|
||||||
|
pixels[i]= (r+g+b)/3;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
pixels[i]= r;
|
||||||
|
pixels[i+1]= g;
|
||||||
|
pixels[i+2]= b;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
pixels[i]= r;
|
||||||
|
pixels[i+1]= g;
|
||||||
|
pixels[i+2]= b;
|
||||||
|
pixels[i+3]= 255;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
switch(components){
|
if (padSize) {
|
||||||
case 1:
|
in.read(buffer,padSize);
|
||||||
pixels[i]= (r+g+b)/3;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
pixels[i]= r;
|
|
||||||
pixels[i+1]= g;
|
|
||||||
pixels[i+2]= b;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
pixels[i]= r;
|
|
||||||
pixels[i+1]= g;
|
|
||||||
pixels[i+2]= b;
|
|
||||||
pixels[i+3]= 255;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*for(int i = 0; i < w*h*components; ++i) {
|
||||||
|
if (i%39 == 0) std::cout << std::endl;
|
||||||
|
int first = pixels[i]/16;
|
||||||
|
if (first < 10)
|
||||||
|
std:: cout << first;
|
||||||
|
else
|
||||||
|
std::cout << (char)('A'+(first-10));
|
||||||
|
first = pixels[i]%16;
|
||||||
|
if (first < 10)
|
||||||
|
std:: cout << first;
|
||||||
|
else
|
||||||
|
std::cout << (char)('A'+(first-10));
|
||||||
|
std::cout << " ";
|
||||||
|
}*/
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -77,7 +77,6 @@ Pixmap2D* JPGReader::read(ifstream& is, const string& path, Pixmap2D* ret) const
|
|||||||
if (buffer[0] != 0xFF || buffer[1] != 0xD8) {
|
if (buffer[0] != 0xFF || buffer[1] != 0xD8) {
|
||||||
std::cout << "0 = [" << std::hex << (int)buffer[0] << "] 1 = [" << std::hex << (int)buffer[1] << "]" << std::endl;
|
std::cout << "0 = [" << std::hex << (int)buffer[0] << "] 1 = [" << std::hex << (int)buffer[1] << "]" << std::endl;
|
||||||
delete[] buffer;
|
delete[] buffer;
|
||||||
std::cout << "Returning NULL jpeg" << std::endl;
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,30 +120,32 @@ Pixmap2D* JPGReader::read(ifstream& is, const string& path, Pixmap2D* ret) const
|
|||||||
|
|
||||||
/*std::cout << "JPEG FILE Information: " << std::endl;
|
/*std::cout << "JPEG FILE Information: " << std::endl;
|
||||||
std::cout << "Image width and height: " << cinfo.image_width <<" pixels and " << cinfo.image_height <<" pixels." << std::endl;
|
std::cout << "Image width and height: " << cinfo.image_width <<" pixels and " << cinfo.image_height <<" pixels." << std::endl;
|
||||||
|
|
||||||
std::cout << "Color components per fixel: " << cinfo.num_components << std::endl;
|
std::cout << "Color components per fixel: " << cinfo.num_components << std::endl;
|
||||||
std::cout << "Color space: " << cinfo.jpeg_color_space << std::endl;*/
|
std::cout << "Color space: " << cinfo.jpeg_color_space << std::endl;*/
|
||||||
const int picComponents = (ret->getComponents() == -1)?cinfo.num_components:ret->getComponents();
|
int picComponents = (ret->getComponents() == -1)?cinfo.num_components:ret->getComponents();
|
||||||
//std::cout << "JPG-Components: Pic: " << picComponents << " old: " << (ret->getComponents()) << " File: " << cinfo.num_components << std::endl;
|
//std::cout << "JPG-Components: Pic: " << picComponents << " old: " << (ret->getComponents()) << " File: " << cinfo.num_components << std::endl;
|
||||||
ret->init(cinfo.image_width, cinfo.image_height, picComponents);
|
//picComponents = 4;
|
||||||
uint8* pixels = ret->getPixels();
|
|
||||||
//TODO: Irrlicht has some special CMYK-handling - maybe needed too?
|
//TODO: Irrlicht has some special CMYK-handling - maybe needed too?
|
||||||
/* Start decompression jpeg here */
|
/* Start decompression jpeg here */
|
||||||
jpeg_start_decompress( &cinfo );
|
jpeg_start_decompress( &cinfo );
|
||||||
|
ret->init(cinfo.image_width, cinfo.image_height, picComponents);
|
||||||
|
uint8* pixels = ret->getPixels();
|
||||||
|
//std::cout << "output width and height: " << cinfo.output_width <<" pixels and " << cinfo.output_height <<" pixels." << std::endl;
|
||||||
/* now actually read the jpeg into the raw buffer */
|
/* now actually read the jpeg into the raw buffer */
|
||||||
row_pointer[0] = new unsigned char[cinfo.output_width*cinfo.num_components];
|
row_pointer[0] = new unsigned char[cinfo.output_width*cinfo.num_components];
|
||||||
size_t location = 0; //Current pixel
|
size_t location = 0; //Current pixel
|
||||||
/* read one scan line at a time */
|
/* read one scan line at a time */
|
||||||
/* Again you need to invert the lines unfortunately*/
|
/* Again you need to invert the lines unfortunately*/
|
||||||
while( cinfo.output_scanline < cinfo.image_height )
|
while( cinfo.output_scanline < cinfo.output_height )
|
||||||
{
|
{
|
||||||
jpeg_read_scanlines( &cinfo, row_pointer, 1 );
|
jpeg_read_scanlines( &cinfo, row_pointer, 1 );
|
||||||
location = (cinfo.image_height - cinfo.output_scanline)*cinfo.image_width*cinfo.num_components;
|
location = (cinfo.output_height - cinfo.output_scanline)*cinfo.output_width*picComponents;
|
||||||
if (picComponents == cinfo.num_components) {
|
if (picComponents == cinfo.num_components) {
|
||||||
memcpy(pixels+location,row_pointer[0],cinfo.image_width*cinfo.num_components);
|
memcpy(pixels+location,row_pointer[0],cinfo.output_width*cinfo.num_components);
|
||||||
} else {
|
} else {
|
||||||
int r,g,b,a,l;
|
int r,g,b,a,l;
|
||||||
for (int xPic = 0, xFile = 0; xPic < cinfo.image_width*picComponents; xPic+= picComponents, xFile+= cinfo.num_components) {
|
for (int xPic = 0, xFile = 0; xPic < cinfo.output_width*picComponents; xPic+= picComponents, xFile+= cinfo.num_components) {
|
||||||
switch(cinfo.num_components) {
|
switch(cinfo.num_components) {
|
||||||
case 3:
|
case 3:
|
||||||
r = row_pointer[0][xFile];
|
r = row_pointer[0][xFile];
|
||||||
@@ -188,6 +189,20 @@ Pixmap2D* JPGReader::read(ifstream& is, const string& path, Pixmap2D* ret) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*for(int i = 0; i < cinfo.image_width*cinfo.image_height*picComponents; ++i) {
|
||||||
|
if (i%39 == 0) std::cout << std::endl;
|
||||||
|
int first = pixels[i]/16;
|
||||||
|
if (first < 10)
|
||||||
|
std:: cout << first;
|
||||||
|
else
|
||||||
|
std::cout << (char)('A'+(first-10));
|
||||||
|
first = pixels[i]%16;
|
||||||
|
if (first < 10)
|
||||||
|
std:: cout << first;
|
||||||
|
else
|
||||||
|
std::cout << (char)('A'+(first-10));
|
||||||
|
std::cout << " ";
|
||||||
|
}*/
|
||||||
/* wrap up decompression, destroy objects, free pointers and close open files */
|
/* wrap up decompression, destroy objects, free pointers and close open files */
|
||||||
jpeg_finish_decompress( &cinfo );
|
jpeg_finish_decompress( &cinfo );
|
||||||
jpeg_destroy_decompress( &cinfo );
|
jpeg_destroy_decompress( &cinfo );
|
||||||
|
@@ -109,6 +109,7 @@ Pixmap2D* PNGReader::read(ifstream& is, const string& path, Pixmap2D* ret) const
|
|||||||
int fileComponents = info_ptr->rowbytes/info_ptr->width;
|
int fileComponents = info_ptr->rowbytes/info_ptr->width;
|
||||||
int picComponents = (ret->getComponents()==-1)?fileComponents:ret->getComponents();
|
int picComponents = (ret->getComponents()==-1)?fileComponents:ret->getComponents();
|
||||||
//std::cout << "PNG-Components: Pic: " << picComponents << " old: " << (ret->getComponents()) << " File: " << fileComponents << std::endl;
|
//std::cout << "PNG-Components: Pic: " << picComponents << " old: " << (ret->getComponents()) << " File: " << fileComponents << std::endl;
|
||||||
|
//picComponents = 4;
|
||||||
//Copy image
|
//Copy image
|
||||||
ret->init(width,height,picComponents);
|
ret->init(width,height,picComponents);
|
||||||
uint8* pixels = ret->getPixels();
|
uint8* pixels = ret->getPixels();
|
||||||
|
@@ -85,7 +85,7 @@ Pixmap2D* TGAReader::read(ifstream& in, const string& path, Pixmap2D* ret) const
|
|||||||
const int w = fileHeader.width;
|
const int w = fileHeader.width;
|
||||||
const int fileComponents= fileHeader.bitsPerPixel/8;
|
const int fileComponents= fileHeader.bitsPerPixel/8;
|
||||||
const int picComponents = (ret->getComponents()==-1)?fileComponents:ret->getComponents();
|
const int picComponents = (ret->getComponents()==-1)?fileComponents:ret->getComponents();
|
||||||
//std::cout << "BMP-Components: Pic: " << picComponents << " old: " << (ret->getComponents()) << " File: " << fileComponents << std::endl;
|
//std::cout << "TGA-Components: Pic: " << picComponents << " old: " << (ret->getComponents()) << " File: " << fileComponents << std::endl;
|
||||||
ret->init(w,h,picComponents);
|
ret->init(w,h,picComponents);
|
||||||
uint8* pixels = ret->getPixels();
|
uint8* pixels = ret->getPixels();
|
||||||
//read file
|
//read file
|
||||||
@@ -131,6 +131,20 @@ Pixmap2D* TGAReader::read(ifstream& in, const string& path, Pixmap2D* ret) const
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*for(int i = 0; i < w*h*picComponents; ++i) {
|
||||||
|
if (i%39 == 0) std::cout << std::endl;
|
||||||
|
int first = pixels[i]/16;
|
||||||
|
if (first < 10)
|
||||||
|
std:: cout << first;
|
||||||
|
else
|
||||||
|
std::cout << (char)('A'+(first-10));
|
||||||
|
first = pixels[i]%16;
|
||||||
|
if (first < 10)
|
||||||
|
std:: cout << first;
|
||||||
|
else
|
||||||
|
std::cout << (char)('A'+(first-10));
|
||||||
|
std::cout << " ";
|
||||||
|
}*/
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -754,6 +754,14 @@ void Pixmap3D::init(int d, int components){
|
|||||||
pixels= NULL;
|
pixels= NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Pixmap3D::init(int components){
|
||||||
|
this->w= -1;
|
||||||
|
this->h= -1;
|
||||||
|
this->d= -1;
|
||||||
|
this->components= components;
|
||||||
|
pixels= NULL;
|
||||||
|
}
|
||||||
|
|
||||||
Pixmap3D::~Pixmap3D(){
|
Pixmap3D::~Pixmap3D(){
|
||||||
delete [] pixels;
|
delete [] pixels;
|
||||||
}
|
}
|
||||||
@@ -821,6 +829,12 @@ void PixmapCube::init(int w, int h, int components){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PixmapCube::init(int components){
|
||||||
|
for(int i=0; i<6; ++i){
|
||||||
|
faces[i].init(components);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//load & save
|
//load & save
|
||||||
void PixmapCube::loadFace(const string &path, int face){
|
void PixmapCube::loadFace(const string &path, int face){
|
||||||
faces[face].load(path);
|
faces[face].load(path);
|
||||||
|
82
source/shared_lib/sources/graphics/texture.cpp
Normal file
82
source/shared_lib/sources/graphics/texture.cpp
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
// ==============================================================
|
||||||
|
// This file is part of Glest Shared Library (www.glest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001-2008 Marti<74>o Figueroa
|
||||||
|
//
|
||||||
|
// You can redistribute this code and/or modify it under
|
||||||
|
// the terms of the GNU General Public License as published
|
||||||
|
// by the Free Software Foundation; either version 2 of the
|
||||||
|
// License, or (at your option) any later version
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#include "texture.h"
|
||||||
|
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
namespace Shared{ namespace Graphics{
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class Texture
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
const int Texture::defaultSize= 256;
|
||||||
|
const int Texture::defaultComponents = 4;
|
||||||
|
|
||||||
|
Texture::Texture(){
|
||||||
|
mipmap= true;
|
||||||
|
pixmapInit= true;
|
||||||
|
wrapMode= wmRepeat;
|
||||||
|
format= fAuto;
|
||||||
|
|
||||||
|
inited= false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class Texture1D
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
void Texture1D::load(const string &path){
|
||||||
|
this->path= path;
|
||||||
|
if (pixmap.getComponents() == -1) { //TODO: look where you really need that
|
||||||
|
pixmap.init(defaultComponents);
|
||||||
|
}
|
||||||
|
pixmap.load(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class Texture2D
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
void Texture2D::load(const string &path){
|
||||||
|
this->path= path;
|
||||||
|
if (pixmap.getComponents() == -1) {
|
||||||
|
pixmap.init(defaultComponents);
|
||||||
|
}
|
||||||
|
pixmap.load(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class Texture3D
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
void Texture3D::loadSlice(const string &path, int slice){
|
||||||
|
this->path= path;
|
||||||
|
if (pixmap.getComponents() == -1) {
|
||||||
|
pixmap.init(defaultComponents);
|
||||||
|
}
|
||||||
|
pixmap.loadSlice(path, slice);
|
||||||
|
}
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class TextureCube
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
void TextureCube::loadFace(const string &path, int face){
|
||||||
|
this->path= path;
|
||||||
|
if (pixmap.getFace(0)->getComponents() == -1) {
|
||||||
|
pixmap.init(defaultComponents);
|
||||||
|
}
|
||||||
|
pixmap.loadFace(path, face);
|
||||||
|
}
|
||||||
|
|
||||||
|
}}//end namespace
|
Reference in New Issue
Block a user