[Bf-blender-cvs] [eabd433] cycles-ptex-49: Merge remote-tracking branch 'origin/master' into cycles-ptex-49

Nicholas Bishop noreply at git.blender.org
Thu Feb 12 19:13:41 CET 2015


Commit: eabd433f3511b7384987f59f6816e492c9aa1c1a
Author: Nicholas Bishop
Date:   Thu Feb 12 19:06:19 2015 +0100
Branches: cycles-ptex-49
https://developer.blender.org/rBeabd433f3511b7384987f59f6816e492c9aa1c1a

Merge remote-tracking branch 'origin/master' into cycles-ptex-49

Conflicts:
	source/blender/gpu/GPU_extensions.h

===================================================================



===================================================================

diff --cc source/blender/gpu/GPU_extensions.h
index 262399d,739d456..9046f7c
--- a/source/blender/gpu/GPU_extensions.h
+++ b/source/blender/gpu/GPU_extensions.h
@@@ -112,9 -118,8 +118,13 @@@ GPUTexture *GPU_texture_create_2D(int w
  GPUTexture *GPU_texture_create_3D(int w, int h, int depth, int channels, float *fpixels);
  GPUTexture *GPU_texture_create_depth(int w, int h, char err_out[256]);
  GPUTexture *GPU_texture_create_vsm_shadow_map(int size, char err_out[256]);
++
 +	// TODO
 +GPUTexture *GPU_ptex_texture_from_blender(struct Image *ima,
 +	struct ImageUser *iuser);
++
+ GPUTexture *GPU_texture_create_2D_procedural(int w, int h, float *pixels, char err_out[256]);
+ GPUTexture *GPU_texture_create_1D_procedural(int w, float *pixels, char err_out[256]);
  GPUTexture *GPU_texture_from_blender(struct Image *ima,
  	struct ImageUser *iuser, bool is_data, double time, int mipmap);
  GPUTexture *GPU_texture_from_preview(struct PreviewImage *prv, int mipmap);
diff --cc source/blender/gpu/intern/gpu_extensions.c
index 5e99db2,4d1a977..7f6dfc1
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@@ -47,12 -47,9 +47,13 @@@
  
  #include "GPU_draw.h"
  #include "GPU_extensions.h"
+ #include "GPU_compositing.h"
  #include "GPU_simple_shader.h"
  
 +// TODO
 +#include "BKE_image.h"
 +#include "IMB_imbuf_types.h"
 +
  #include "intern/gpu_extensions_private.h"
  
  #include <stdlib.h>
@@@ -702,54 -773,6 +777,54 @@@ GPUTexture *GPU_texture_create_1D_proce
  	return tex;
  }
  
 +// Very TODO, the code in this file could use a bit of a scrub
 +GPUTexture *GPU_ptex_texture_from_blender(Image *ima, ImageUser *UNUSED(iuser))
 +{
 +
 +	ImBuf *ibuf;
 +	GPUTexture *tex;
 +	int size;
 +	BPXRect *data;
 +	void *lock;
 +
 +	if (ima->ptex_gputexture) {
 +		return ima->ptex_gputexture;
 +	}
 +
 +	ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
 +	if (!ibuf) return NULL;
 +
 +	size = ibuf->num_ptex_regions;
 +	data = ibuf->ptex_regions;
 +
- 	tex = GPU_texture_create_nD(size, 1, 2, NULL, 0, NULL);
++	tex = GPU_texture_create_nD(size, 1, 2, NULL, 0, GPU_HDR_NONE, 4, NULL);
 +	ima->ptex_gputexture = tex;
 +
 +	if (tex) {
 +		/* Now we tweak some of the settings */
 +		/* glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); */
 +		/* glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); */
 +		// TODO
 +		float (*tmp)[4] = MEM_mallocN(sizeof(*tmp) * size, "tmp");
 +		int i;
 +		for (i = 0; i < size; i++) {
 +			const BPXRect *rect = &data[i];
 +			tmp[i][0] = rect->xbegin;
 +			tmp[i][1] = rect->ybegin;
 +			tmp[i][2] = rect->xend - rect->xbegin;
 +			tmp[i][3] = rect->yend - rect->ybegin;
 +		}
 +		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, size, 1, 0, GL_RGBA, GL_FLOAT, tmp);
 +		MEM_freeN(tmp);
 +
 +		GPU_texture_unbind(tex);
 +	}
 +
 +	BKE_image_release_ibuf(ima, ibuf, lock);
 +
 +	return tex;
 +}
 +
  void GPU_invalid_tex_init(void)
  {
  	float color[4] = {1.0f, 0.0f, 1.0f, 1.0};




More information about the Bf-blender-cvs mailing list