framework2

Форк
0
60 строк · 1.5 Кб
1
//
2
//  ofxAsssimpTexture.cpp
3
//
4
//  Created by Lukasz Karluk on 27/03/13.
5
//
6
//
7

8
#include "ofxAssimpTexture.h"
9
#include "ofLog.h"
10
#include "ofUtils.h"
11

12
void ofxAssimpTexture::setup(const ofTexture & texture, const of::filesystem::path & texturePath, bool bTexRepeat) {
13
	this->texture = texture;
14
	if( bTexRepeat ){
15
		this->texture.setTextureWrap(GL_REPEAT, GL_REPEAT);
16
	}else{
17
		this->texture.setTextureWrap(GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE);
18
	}
19
	this->texturePath = texturePath;
20
}
21

22
#ifndef TARGET_WIN32
23
//this is a hack to allow for weak definations of functions that might not exist in older assimp versions
24
const char *aiTextureTypeToString(enum aiTextureType in)__attribute__((weak));
25
#endif
26

27
void ofxAssimpTexture::setTextureType(aiTextureType aTexType){
28
	textureType = aTexType;
29

30
	if( textureType >= 0 && textureType < AI_TEXTURE_TYPE_MAX){
31
		if(aiTextureTypeToString){
32
			mTexTypeStr = aiTextureTypeToString(getTextureType());
33
		}else{
34
			mTexTypeStr = "textureType:"+ofToString(getTextureType());
35
		}
36
	}else{
37
		ofLogError("ofxAssimpTexture::setTextureType") << ": unknown aiTextureType type " << aTexType;
38
		mTexTypeStr = "NONE";
39
	}
40
}
41

42
ofTexture & ofxAssimpTexture::getTextureRef() {
43
	return texture;
44
}
45

46
of::filesystem::path ofxAssimpTexture::getTexturePath() {
47
	return texturePath;
48
}
49

50
bool ofxAssimpTexture::hasTexture() {
51
	return texture.isAllocated();
52
}
53

54
aiTextureType ofxAssimpTexture::getTextureType() const{
55
	return textureType;
56
}
57

58
std::string ofxAssimpTexture::getTextureTypeAsString() const{
59
	return mTexTypeStr;
60
}
61

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.