Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2010-02-13 16:09:30 +0300
committerTon Roosendaal <ton@blender.org>2010-02-13 16:09:30 +0300
commitb673f7318c9733f009acfae1b640ca14eec79047 (patch)
tree15c34a90d192b91a3f52b562fdbed0abd413e12b /source/blender/gpu/intern
parentc1ee920db648af27a7912c997b270d2ed2fdf293 (diff)
Added support for animated texture draw, GLSL textures.
Note, this is not like GE ffmpg, but Blender Image Texture display for GLSL materials. Speed can be disappointing, use smaller images for realtime edits.
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r--source/blender/gpu/intern/gpu_codegen.c1
-rw-r--r--source/blender/gpu/intern/gpu_draw.c12
-rw-r--r--source/blender/gpu/intern/gpu_extensions.c2
-rw-r--r--source/blender/gpu/intern/gpu_material.c2
4 files changed, 12 insertions, 5 deletions
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index 168c6645910..efaae5c2720 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -997,6 +997,7 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, int type)
input->source = GPU_SOURCE_TEX;
input->ima = link->ptr1;
+ input->iuser = link->ptr2;
input->textarget = GL_TEXTURE_2D;
input->textype = GPU_TEX2D;
MEM_freeN(link);
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index fea93d13cc5..10638ca552a 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -392,7 +392,7 @@ static void gpu_verify_reflection(Image *ima)
}
}
-int GPU_verify_image(Image *ima, int tftile, int tfmode, int compare, int mipmap)
+int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int tfmode, int compare, int mipmap)
{
ImBuf *ibuf = NULL;
unsigned int *bind = NULL;
@@ -444,7 +444,7 @@ int GPU_verify_image(Image *ima, int tftile, int tfmode, int compare, int mipmap
return 0;
/* check if we have a valid image buffer */
- ibuf= BKE_image_get_ibuf(ima, NULL);
+ ibuf= BKE_image_get_ibuf(ima, iuser);
if(ibuf==NULL)
return 0;
@@ -453,6 +453,12 @@ int GPU_verify_image(Image *ima, int tftile, int tfmode, int compare, int mipmap
if ((ibuf->rect==NULL) && ibuf->rect_float)
IMB_rect_from_float(ibuf);
+ /* currently, tpage refresh is used by ima sequences */
+ if(ima->tpageflag & IMA_TPAGE_REFRESH) {
+ GPU_free_image(ima);
+ ima->tpageflag &= ~IMA_TPAGE_REFRESH;
+ }
+
if(GTS.tilemode) {
/* tiled mode */
if(ima->repbind==0) gpu_make_repbind(ima);
@@ -585,7 +591,7 @@ int GPU_set_tpage(MTFace *tface, int mipmap)
gpu_verify_alpha_mode(tface);
gpu_verify_reflection(ima);
- if(GPU_verify_image(ima, tface->tile, tface->mode, 1, mipmap)) {
+ if(GPU_verify_image(ima, NULL, tface->tile, tface->mode, 1, mipmap)) {
GTS.curtile= GTS.tile;
GTS.curima= GTS.ima;
GTS.curtilemode= GTS.tilemode;
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index 8d0bd819deb..3ca55c12ce2 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -471,7 +471,7 @@ GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser *iuser, double time,
glGetIntegerv(GL_TEXTURE_BINDING_2D, &lastbindcode);
GPU_update_image_time(ima, time);
- bindcode = GPU_verify_image(ima, 0, 0, 0, mipmap);
+ bindcode = GPU_verify_image(ima, iuser, 0, 0, 0, mipmap);
if(ima->gputexture) {
ima->gputexture->bindcode = bindcode;
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 3b33c2eba62..0d2b6747f79 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -960,7 +960,7 @@ static void do_material_tex(GPUShadeInput *shi)
rgbnor = 0;
if(tex && tex->type == TEX_IMAGE && tex->ima) {
- GPU_link(mat, "mtex_image", texco, GPU_image(tex->ima, NULL), &tin, &trgb, &tnor);
+ GPU_link(mat, "mtex_image", texco, GPU_image(tex->ima, &tex->iuser), &tin, &trgb, &tnor);
rgbnor= TEX_RGB;
if(tex->imaflag & TEX_USEALPHA)