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:
authorDalai Felinto <dfelinto@gmail.com>2014-07-28 21:29:03 +0400
committerDalai Felinto <dfelinto@gmail.com>2014-07-31 07:35:16 +0400
commit9952699978a132e4866acd26817fb9cfec23419d (patch)
treee0bdf99211ecc815b44636ea78a33ddf91cf6b4b /source/blender/render
parent5e4a97d109b24444b9f2a80fdea6788d4d7a140d (diff)
Bake-API: use size_t instead of width, height
(original patch by Sergey Sharybin) Note: RNA API can't use size_t at the moment. Once it does this patch can be tweaked a bit to fully benefit from size_t larger dimensions. (right now num_pixels is passed as int) Reviewed By: sergey, campbellbarton Differential Revision: https://developer.blender.org/D688
Diffstat (limited to 'source/blender/render')
-rw-r--r--source/blender/render/extern/include/RE_bake.h18
-rw-r--r--source/blender/render/intern/source/bake_api.c42
-rw-r--r--source/blender/render/intern/source/external_engine.c2
3 files changed, 31 insertions, 31 deletions
diff --git a/source/blender/render/extern/include/RE_bake.h b/source/blender/render/extern/include/RE_bake.h
index 8f2a0e382a4..481da452529 100644
--- a/source/blender/render/extern/include/RE_bake.h
+++ b/source/blender/render/extern/include/RE_bake.h
@@ -39,7 +39,7 @@ typedef struct BakeImage {
struct Image *image;
int width;
int height;
- int offset;
+ size_t offset;
} BakeImage;
typedef struct BakeImages {
@@ -72,35 +72,35 @@ bool RE_bake_has_engine(struct Render *re);
bool RE_bake_engine(
struct Render *re, struct Object *object, const BakePixel pixel_array[],
- const int num_pixels, const int depth, const ScenePassType pass_type, float result[]);
+ const size_t num_pixels, const int depth, const ScenePassType pass_type, float result[]);
/* bake.c */
int RE_pass_depth(const ScenePassType pass_type);
bool RE_bake_internal(
struct Render *re, struct Object *object, const BakePixel pixel_array[],
- const int num_pixels, const int depth, const ScenePassType pass_type, float result[]);
+ const size_t num_pixels, const int depth, const ScenePassType pass_type, float result[]);
bool RE_bake_pixels_populate_from_objects(
struct Mesh *me_low, BakePixel pixel_array_from[],
- BakeHighPolyData highpoly[], const int tot_highpoly, const int num_pixels, const bool is_custom_cage,
+ BakeHighPolyData highpoly[], const int tot_highpoly, const size_t num_pixels, const bool is_custom_cage,
const float cage_extrusion, float mat_low[4][4], float mat_cage[4][4], struct Mesh *me_cage);
void RE_bake_pixels_populate(
struct Mesh *me, struct BakePixel *pixel_array,
- const int num_pixels, const struct BakeImages *bake_images, const char *uv_layer);
+ const size_t num_pixels, const struct BakeImages *bake_images, const char *uv_layer);
-void RE_bake_mask_fill(const BakePixel pixel_array[], const int num_pixels, char *mask);
+void RE_bake_mask_fill(const BakePixel pixel_array[], const size_t num_pixels, char *mask);
void RE_bake_margin(struct ImBuf *ibuf, char *mask, const int margin);
void RE_bake_normal_world_to_object(
- const BakePixel pixel_array[], const int num_pixels, const int depth, float result[],
+ const BakePixel pixel_array[], const size_t num_pixels, const int depth, float result[],
struct Object *ob, const BakeNormalSwizzle normal_swizzle[3]);
void RE_bake_normal_world_to_tangent(
- const BakePixel pixel_array[], const int num_pixels, const int depth, float result[],
+ const BakePixel pixel_array[], const size_t num_pixels, const int depth, float result[],
struct Mesh *me, const BakeNormalSwizzle normal_swizzle[3], float mat[4][4]);
void RE_bake_normal_world_to_world(
- const BakePixel pixel_array[], const int num_pixels, const int depth, float result[],
+ const BakePixel pixel_array[], const size_t num_pixels, const int depth, float result[],
const BakeNormalSwizzle normal_swizzle[3]);
void RE_bake_ibuf_clear(struct Image *image, const bool is_tangent);
diff --git a/source/blender/render/intern/source/bake_api.c b/source/blender/render/intern/source/bake_api.c
index 15ad6051f4c..08fea632cd4 100644
--- a/source/blender/render/intern/source/bake_api.c
+++ b/source/blender/render/intern/source/bake_api.c
@@ -120,7 +120,7 @@ static void store_bake_pixel(void *handle, int x, int y, float u, float v)
BakePixel *pixel;
const int width = bd->bk_image->width;
- const int offset = bd->bk_image->offset;
+ const size_t offset = bd->bk_image->offset;
const int i = offset + y * width + x;
pixel = &bd->pixel_array[i];
@@ -134,9 +134,9 @@ static void store_bake_pixel(void *handle, int x, int y, float u, float v)
pixel->dv_dy = bd->dv_dy;
}
-void RE_bake_mask_fill(const BakePixel pixel_array[], const int num_pixels, char *mask)
+void RE_bake_mask_fill(const BakePixel pixel_array[], const size_t num_pixels, char *mask)
{
- int i;
+ size_t i;
if (!mask)
return;
@@ -438,10 +438,10 @@ static void mesh_calc_tri_tessface(
bool RE_bake_pixels_populate_from_objects(
struct Mesh *me_low, BakePixel pixel_array_from[],
- BakeHighPolyData highpoly[], const int tot_highpoly, const int num_pixels, const bool is_custom_cage,
+ BakeHighPolyData highpoly[], const int tot_highpoly, const size_t num_pixels, const bool is_custom_cage,
const float cage_extrusion, float mat_low[4][4], float mat_cage[4][4], struct Mesh *me_cage)
{
- int i;
+ size_t i;
int primitive_id;
float u, v;
float imat_low [4][4];
@@ -594,11 +594,11 @@ static void bake_differentials(BakeDataZSpan *bd, const float *uv1, const float
void RE_bake_pixels_populate(
Mesh *me, BakePixel pixel_array[],
- const int num_pixels, const BakeImages *bake_images, const char *uv_layer)
+ const size_t num_pixels, const BakeImages *bake_images, const char *uv_layer)
{
BakeDataZSpan bd;
- int i, a;
- int p_id;
+ size_t i;
+ int a, p_id;
MTFace *mtface;
MFace *mface;
@@ -725,11 +725,11 @@ static void normal_compress(float out[3], const float in[3], const BakeNormalSwi
* This function converts an object space normal map to a tangent space normal map for a given low poly mesh
*/
void RE_bake_normal_world_to_tangent(
- const BakePixel pixel_array[], const int num_pixels, const int depth,
+ const BakePixel pixel_array[], const size_t num_pixels, const int depth,
float result[], Mesh *me, const BakeNormalSwizzle normal_swizzle[3],
float mat[4][4])
{
- int i;
+ size_t i;
TriTessFace *triangles;
@@ -756,7 +756,7 @@ void RE_bake_normal_world_to_tangent(
float tsm[3][3]; /* tangent space matrix */
float itsm[3][3];
- int offset;
+ size_t offset;
float nor[3]; /* texture normal */
bool is_smooth;
@@ -834,16 +834,16 @@ void RE_bake_normal_world_to_tangent(
}
void RE_bake_normal_world_to_object(
- const BakePixel pixel_array[], const int num_pixels, const int depth,
+ const BakePixel pixel_array[], const size_t num_pixels, const int depth,
float result[], struct Object *ob, const BakeNormalSwizzle normal_swizzle[3])
{
- int i;
+ size_t i;
float iobmat[4][4];
invert_m4_m4(iobmat, ob->obmat);
for (i = 0; i < num_pixels; i++) {
- int offset;
+ size_t offset;
float nor[3];
if (pixel_array[i].primitive_id == -1)
@@ -862,13 +862,13 @@ void RE_bake_normal_world_to_object(
}
void RE_bake_normal_world_to_world(
- const BakePixel pixel_array[], const int num_pixels, const int depth,
+ const BakePixel pixel_array[], const size_t num_pixels, const int depth,
float result[], const BakeNormalSwizzle normal_swizzle[3])
{
- int i;
+ size_t i;
for (i = 0; i < num_pixels; i++) {
- int offset;
+ size_t offset;
float nor[3];
if (pixel_array[i].primitive_id == -1)
@@ -908,12 +908,12 @@ void RE_bake_ibuf_clear(Image *image, const bool is_tangent)
/**
* not the real UV, but the internal per-face UV instead
* I'm using it to test if everything is correct */
-static bool bake_uv(const BakePixel pixel_array[], const int num_pixels, const int depth, float result[])
+static bool bake_uv(const BakePixel pixel_array[], const size_t num_pixels, const int depth, float result[])
{
- int i;
+ size_t i;
for (i=0; i < num_pixels; i++) {
- int offset = i * depth;
+ size_t offset = i * depth;
copy_v2_v2(&result[offset], pixel_array[i].uv);
}
@@ -922,7 +922,7 @@ static bool bake_uv(const BakePixel pixel_array[], const int num_pixels, const i
bool RE_bake_internal(
Render *UNUSED(re), Object *UNUSED(object), const BakePixel pixel_array[],
- const int num_pixels, const int depth, const ScenePassType pass_type, float result[])
+ const size_t num_pixels, const int depth, const ScenePassType pass_type, float result[])
{
switch (pass_type) {
case SCE_PASS_UV:
diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c
index 58e3038682c..3c35d500948 100644
--- a/source/blender/render/intern/source/external_engine.c
+++ b/source/blender/render/intern/source/external_engine.c
@@ -425,7 +425,7 @@ bool RE_bake_has_engine(Render *re)
bool RE_bake_engine(
Render *re, Object *object, const BakePixel pixel_array[],
- const int num_pixels, const int depth,
+ const size_t num_pixels, const int depth,
const ScenePassType pass_type, float result[])
{
RenderEngineType *type = RE_engines_find(re->r.engine);