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
path: root/source
diff options
context:
space:
mode:
authorNicholas Bishop <nicholasbishop@gmail.com>2008-01-30 06:40:28 +0300
committerNicholas Bishop <nicholasbishop@gmail.com>2008-01-30 06:40:28 +0300
commit1dd0d17cf48a0db46b747aaa25d5e5ea8d3f2a72 (patch)
tree7f75171f420cf3571da43b29af4b80cdbb10ffc4 /source
parent4ed28a99a70fdceb85e8e4f6972fc632cf192d79 (diff)
== Sculpt ==
Replace a 'magic number' used in several places with a proper constant
Diffstat (limited to 'source')
-rw-r--r--source/blender/src/sculptmode.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/source/blender/src/sculptmode.c b/source/blender/src/sculptmode.c
index dbefadb2646..1ded7106f47 100644
--- a/source/blender/src/sculptmode.c
+++ b/source/blender/src/sculptmode.c
@@ -105,6 +105,9 @@
/* Number of vertices to average in order to determine the flatten distance */
#define FLATTEN_SAMPLE_SIZE 10
+/* Texture cache size */
+#define TC_SIZE 256
+
/* ===== STRUCTS =====
*
*/
@@ -1085,7 +1088,7 @@ void sculptmode_update_tex()
SculptSession *ss= sculpt_session();
MTex *mtex = sd->mtex[sd->texact];
TexResult texres = {0};
- float x, y, step=2.0/128.0, co[3];
+ float x, y, step=2.0/TC_SIZE, co[3];
int hasrgb, ix, iy;
/* Skip Default brush shape and non-textures */
@@ -1096,15 +1099,15 @@ void sculptmode_update_tex()
ss->texcache= NULL;
}
- ss->texcache_w = ss->texcache_h = 128;
+ ss->texcache_w = ss->texcache_h = TC_SIZE;
ss->texcache = MEM_callocN(sizeof(int) * ss->texcache_w * ss->texcache_h, "Sculpt Texture cache");
if(mtex && mtex->tex) {
BKE_image_get_ibuf(sd->mtex[sd->texact]->tex->ima, NULL);
/*do normalized cannonical view coords for texture*/
- for (y=-1.0, iy=0; iy<128; iy++, y += step) {
- for (x=-1.0, ix=0; ix<128; ix++, x += step) {
+ for (y=-1.0, iy=0; iy<TC_SIZE; iy++, y += step) {
+ for (x=-1.0, ix=0; ix<TC_SIZE; ix++, x += step) {
co[0]= x;
co[1]= y;
co[2]= 0.0f;
@@ -1121,10 +1124,10 @@ void sculptmode_update_tex()
texres.tg + 0.2 * texres.tb);
texres.tin = texres.tin * 255.0;
- ((char*)ss->texcache)[(iy*128+ix)*4] = (char)texres.tin;
- ((char*)ss->texcache)[(iy*128+ix)*4+1] = (char)texres.tin;
- ((char*)ss->texcache)[(iy*128+ix)*4+2] = (char)texres.tin;
- ((char*)ss->texcache)[(iy*128+ix)*4+3] = (char)texres.tin;
+ ((char*)ss->texcache)[(iy*TC_SIZE+ix)*4] = (char)texres.tin;
+ ((char*)ss->texcache)[(iy*TC_SIZE+ix)*4+1] = (char)texres.tin;
+ ((char*)ss->texcache)[(iy*TC_SIZE+ix)*4+2] = (char)texres.tin;
+ ((char*)ss->texcache)[(iy*TC_SIZE+ix)*4+3] = (char)texres.tin;
}
}
}
@@ -1237,7 +1240,7 @@ static GLuint sculpt_radialcontrol_calctex()
SculptData *sd= sculpt_data();
SculptSession *ss= sculpt_session();
int i, j;
- const int tsz = 128;
+ const int tsz = TC_SIZE;
float *texdata= MEM_mallocN(sizeof(float)*tsz*tsz, "Brush preview");
GLuint tex;