texture mixing

This commit is contained in:
devZoGok
2021-10-19 19:06:41 +03:00
parent 0741a46fe8
commit 0bf222d38d
5 changed files with 43 additions and 32 deletions
+7 -6
View File
@@ -34,9 +34,10 @@ namespace vb01{
}
}
Texture::Texture(string path[], int numPaths, int updateRate, bool flip){
Texture::Texture(string path[], int numPaths, TextureTypeId textureTypeId, bool flip){
mixRatio = .1;
this->typeId = textureTypeId;
this->numFrames = numPaths;
this->updateRate = updateRate;
texture = new u32[numPaths];
@@ -148,10 +149,10 @@ namespace vb01{
}
void Texture::update(int id){
updateFrame();
//updateFrame();
select(id);
if(numFrames > 0)
select(id + 1);
select(id + 1, 1);
}
void Texture::updateFrame(){
@@ -163,8 +164,8 @@ namespace vb01{
}
}
void Texture::select(int id){
void Texture::select(int id, int fr){
glActiveTexture(GL_TEXTURE0 + id);
glBindTexture(type == TEXTURE_2D ? GL_TEXTURE_2D : GL_TEXTURE_CUBE_MAP, texture[frame]);
glBindTexture(type == TEXTURE_2D ? GL_TEXTURE_2D : GL_TEXTURE_CUBE_MAP, texture[fr]);
}
}