forked from openframeworks/openFrameworks
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathofxAssimpTexture.cpp
More file actions
59 lines (49 loc) · 1.48 KB
/
ofxAssimpTexture.cpp
File metadata and controls
59 lines (49 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//
// ofxAsssimpTexture.cpp
//
// Created by Lukasz Karluk on 27/03/13.
//
//
#include "ofxAssimpTexture.h"
#include "ofLog.h"
void ofxAssimpTexture::setup(const ofTexture & texture, const of::filesystem::path & texturePath, bool bTexRepeat) {
this->texture = texture;
if( bTexRepeat ){
this->texture.setTextureWrap(GL_REPEAT, GL_REPEAT);
}else{
this->texture.setTextureWrap(GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE);
}
this->texturePath = texturePath;
}
#ifndef TARGET_WIN32
//this is a hack to allow for weak definations of functions that might not exist in older assimp versions
const char *aiTextureTypeToString(enum aiTextureType in)__attribute__((weak));
#endif
void ofxAssimpTexture::setTextureType(aiTextureType aTexType){
textureType = aTexType;
if( textureType >= 0 && textureType < AI_TEXTURE_TYPE_MAX){
if(aiTextureTypeToString){
mTexTypeStr = aiTextureTypeToString(getTextureType());
}else{
mTexTypeStr = "textureType:"+ofToString(getTextureType());
}
}else{
ofLogError("ofxAssimpTexture::setTextureType") << ": unknown aiTextureType type " << aTexType;
mTexTypeStr = "NONE";
}
}
ofTexture & ofxAssimpTexture::getTextureRef() {
return texture;
}
of::filesystem::path ofxAssimpTexture::getTexturePath() {
return texturePath;
}
bool ofxAssimpTexture::hasTexture() {
return texture.isAllocated();
}
aiTextureType ofxAssimpTexture::getTextureType() const{
return textureType;
}
std::string ofxAssimpTexture::getTextureTypeAsString() const{
return mTexTypeStr;
}