mirror of
https://github.com/devZoGok/vb01.git
synced 2026-08-26 19:43:30 +00:00
beginning of suitting textures for animation
This commit is contained in:
+4
-4
@@ -150,14 +150,14 @@ namespace vb01{
|
||||
void Texture::update(int id){
|
||||
updateFrame();
|
||||
select(id);
|
||||
if(numFrames > 0)
|
||||
select(id + 1);
|
||||
}
|
||||
|
||||
void Texture::updateFrame(){
|
||||
if(numFrames > 0){
|
||||
if(getTime() - lastUpdateTime > updateRate){
|
||||
frame++;
|
||||
if(frame == numFrames)
|
||||
frame = 0;
|
||||
frame = getNextFrame(frame);
|
||||
lastUpdateTime = getTime();
|
||||
}
|
||||
}
|
||||
@@ -165,6 +165,6 @@ namespace vb01{
|
||||
|
||||
void Texture::select(int id){
|
||||
glActiveTexture(GL_TEXTURE0 + id);
|
||||
glBindTexture(type == TEXTURE_2D ? GL_TEXTURE_2D : GL_TEXTURE_CUBE_MAP, texture[numFrames > 0 ? frame : 0]);
|
||||
glBindTexture(type == TEXTURE_2D ? GL_TEXTURE_2D : GL_TEXTURE_CUBE_MAP, texture[frame]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user