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:
authorAntony Riakiotakis <kalast@gmail.com>2011-06-07 02:10:05 +0400
committerAntony Riakiotakis <kalast@gmail.com>2011-06-07 02:10:05 +0400
commitb481524fde453884f8854a95bba1c1fdeb46959f (patch)
treeb9a065e7d239f84a95fa79e2181b6b45fd264686 /source/blender/blenlib
parent9088b69f7a1707b6826cc6cb50e59fa3b6fbcdda (diff)
fix for float projection painting, now updating correctly.
This fix also allows for partial update of the image, speeding up painting. The different code path implemented will be used to upload high resolution images to OpenGL when onion branch is merged. Due to conversion of float textures to/from sRGB, corrections made to brush color sampling to take account of the image profile. This is not 100% correct yet as texture images used for projection painting strokes are not converted to/from sRGB yet(This has been decided due to loss of precision for 8-bit formats). It will have to do for now, though. last-minute update, exr image loading is broken, will fix asap
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_math_vector.h2
-rw-r--r--source/blender/blenlib/BLI_utildefines.h6
-rw-r--r--source/blender/blenlib/intern/math_vector_inline.c15
3 files changed, 23 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index 5f26bff0ad9..decfa22c3e6 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -58,6 +58,8 @@ MINLINE void swap_v4_v4(float a[4], float b[4]);
/********************************* Arithmetic ********************************/
+MINLINE void add_v3_fl(float r[3], float f);
+MINLINE void add_v4_fl(float r[4], float f);
MINLINE void add_v2_v2(float r[2], const float a[2]);
MINLINE void add_v2_v2v2(float r[2], const float a[2], const float b[2]);
MINLINE void add_v3_v3(float r[3], const float a[3]);
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h
index a376d048412..9af55601ff7 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -103,6 +103,12 @@
#define FTOCHAR(val) ((val)<=0.0f)? 0 : (((val)>(1.0f-0.5f/255.0f))? 255 : (char)((255.0f*(val))+0.5f))
#define FTOUSHORT(val) ((val >= 1.0f-0.5f/65535)? 65535: (val <= 0.0f)? 0: (unsigned short)(val*65535.0f + 0.5f))
+#define F3TOCHAR3(v2,v1) (v1)[0]=FTOCHAR((v2[0])); (v1)[1]=FTOCHAR((v2[1])); (v1)[2]=FTOCHAR((v2[2]))
+#define F3TOCHAR4(v2,v1) { (v1)[0]=FTOCHAR((v2[0])); (v1)[1]=FTOCHAR((v2[1])); (v1)[2]=FTOCHAR((v2[2])); \
+ (v1)[3]=FTOCHAR((v2[3])); (v1)[3] = 255; }
+#define F4TOCHAR4(v2,v1) { (v1)[0]=FTOCHAR((v2[0])); (v1)[1]=FTOCHAR((v2[1])); (v1)[2]=FTOCHAR((v2[2])); \
+ (v1)[3]=FTOCHAR((v2[3])); (v1)[3]=FTOCHAR((v2[3])); }
+
#define VECCOPY(v1,v2) {*(v1)= *(v2); *(v1+1)= *(v2+1); *(v1+2)= *(v2+2);}
#define VECCOPY2D(v1,v2) {*(v1)= *(v2); *(v1+1)= *(v2+1);}
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c
index 9f6a8afe2d5..e2b7c770356 100644
--- a/source/blender/blenlib/intern/math_vector_inline.c
+++ b/source/blender/blenlib/intern/math_vector_inline.c
@@ -102,6 +102,21 @@ MINLINE void swap_v4_v4(float a[4], float b[4])
/********************************* Arithmetic ********************************/
+MINLINE void add_v3_fl(float r[3], float f)
+{
+ r[0] += f;
+ r[1] += f;
+ r[2] += f;
+}
+
+MINLINE void add_v4_fl(float r[4], float f)
+{
+ r[0] += f;
+ r[1] += f;
+ r[2] += f;
+ r[3] += f;
+}
+
MINLINE void add_v2_v2(float *r, const float *a)
{
r[0] += a[0];