[Bf-blender-cvs] [ca9d86b] cycles-ptex-49: Naming cleanup: better consistency in extern/ptex
Nicholas Bishop
noreply at git.blender.org
Sun Feb 8 16:15:52 CET 2015
Commit: ca9d86b2ea8dfb6fbae28f6b6982aeed1bb0caae
Author: Nicholas Bishop
Date: Sun Feb 8 16:03:20 2015 +0100
Branches: cycles-ptex-49
https://developer.blender.org/rBca9d86b2ea8dfb6fbae28f6b6982aeed1bb0caae
Naming cleanup: better consistency in extern/ptex
===================================================================
D extern/ptex/BPX_pack.h
A extern/ptex/BPX_packed_layout.h
A extern/ptex/BPX_ptex.h
M extern/ptex/CMakeLists.txt
M extern/ptex/bpx_c_api.cpp
D extern/ptex/ptex_packed_layout.h
M intern/cycles/render/image.cpp
M source/blender/blenkernel/intern/bke_ptex.c
M source/blender/imbuf/IMB_imbuf.h
M source/blender/imbuf/intern/imb_ptex.c
===================================================================
diff --git a/extern/ptex/ptex_packed_layout.h b/extern/ptex/BPX_packed_layout.h
similarity index 95%
rename from extern/ptex/ptex_packed_layout.h
rename to extern/ptex/BPX_packed_layout.h
index a72c435..03af5f0 100644
--- a/extern/ptex/ptex_packed_layout.h
+++ b/extern/ptex/BPX_packed_layout.h
@@ -1,5 +1,5 @@
-#ifndef __PTEX_PACKED_LAYOUT_H__
-#define __PTEX_PACKED_LAYOUT_H__
+#ifndef __BPX_PACKED_LAYOUT_H__
+#define __BPX_PACKED_LAYOUT_H__
#include <algorithm>
#include <cassert>
@@ -15,7 +15,7 @@
//
// TODO(nicholasbishop): not sure if it's worth aiming for
// power-of-two output texture?
-struct PtexPackedLayout {
+struct BPXPackedLayout {
struct Item {
Item(const int u_res, const int v_res)
: u_res(u_res), v_res(v_res), id(-1), x(-1), y(-1)
@@ -31,7 +31,7 @@ struct PtexPackedLayout {
typedef std::vector<Item> Items;
- PtexPackedLayout(const int count)
+ BPXPackedLayout(const int count)
: width(0), height(0), u_max_res(0), v_max_res(0)
{
items.reserve(count);
diff --git a/extern/ptex/BPX_pack.h b/extern/ptex/BPX_ptex.h
similarity index 81%
rename from extern/ptex/BPX_pack.h
rename to extern/ptex/BPX_ptex.h
index 11a0af2..8a902b1 100644
--- a/extern/ptex/BPX_pack.h
+++ b/extern/ptex/BPX_ptex.h
@@ -1,5 +1,5 @@
-#ifndef __BPX_PACK_H__
-#define __BPX_PACK_H__
+#ifndef __BPX_PTEX_H__
+#define __BPX_PTEX_H__
#ifdef __cplusplus
extern "C"{
@@ -120,27 +120,26 @@ bool TODO_test_write(BPXImageBuf *bpx_buf, const char *path);
bool BPX_image_buf_transform(BPXImageBuf *bpx_buf);
-int BPX_packed_layout_num_regions(const struct PtexPackedLayout *layout);
+int BPX_packed_layout_num_regions(const struct BPXPackedLayout *layout);
typedef BPXImageBuf* (*BPXImageBufFromLayout)
- (const struct PtexPackedLayout *layout, void *context);
+ (const struct BPXPackedLayout *layout, void *context);
BPXImageBuf *BPX_image_buf_ptex_pack(BPXImageInput *bpx_src,
BPXImageBufFromLayout dst_create_func,
void *dst_create_context);
-// TODO: naming
-struct PtexPackedLayout;
-struct PtexPackedLayout *ptex_packed_layout_new(int count);
-void ptex_packed_layout_add(struct PtexPackedLayout *layout,
- int u_res, int v_res, int id);
-void ptex_packed_layout_finalize(struct PtexPackedLayout *layout);
-int ptex_packed_layout_width(const struct PtexPackedLayout *layout);
-int ptex_packed_layout_height(const struct PtexPackedLayout *layout);
-bool ptex_packed_layout_item(const struct PtexPackedLayout *layout,
- int id, int *x, int *y,
- int *width, int *height);
-void ptex_packed_layout_delete(struct PtexPackedLayout *layout);
+struct BPXPackedLayout;
+struct BPXPackedLayout *BPX_packed_layout_new(int count);
+void BPX_packed_layout_add(struct BPXPackedLayout *layout,
+ int u_res, int v_res, int id);
+void BPX_packed_layout_finalize(struct BPXPackedLayout *layout);
+int BPX_packed_layout_width(const struct BPXPackedLayout *layout);
+int BPX_packed_layout_height(const struct BPXPackedLayout *layout);
+bool BPX_packed_layout_item(const struct BPXPackedLayout *layout,
+ int id, int *x, int *y,
+ int *width, int *height);
+void BPX_packed_layout_delete(struct BPXPackedLayout *layout);
#ifdef __cplusplus
} /* extern "C" */
diff --git a/extern/ptex/CMakeLists.txt b/extern/ptex/CMakeLists.txt
index 0de6696..8e53f43 100644
--- a/extern/ptex/CMakeLists.txt
+++ b/extern/ptex/CMakeLists.txt
@@ -31,7 +31,9 @@ set(INC_SYS
)
set(SRC
- BPX_pack.h
+ BPX_ptex.h
+ BPX_packed_layout.h
+
bpx_c_api.cpp
)
diff --git a/extern/ptex/bpx_c_api.cpp b/extern/ptex/bpx_c_api.cpp
index 81730de..7a2a41a 100644
--- a/extern/ptex/bpx_c_api.cpp
+++ b/extern/ptex/bpx_c_api.cpp
@@ -3,8 +3,8 @@
#include <OpenImageIO/imagebuf.h>
#include <OpenImageIO/imagebufalgo.h>
-#include "BPX_pack.h"
-#include "ptex_packed_layout.h"
+#include "BPX_packed_layout.h"
+#include "BPX_ptex.h"
OIIO_NAMESPACE_USING
@@ -792,7 +792,7 @@ static bool bpx_ptex_file_mesh_edges(BPXMeshEdges &edges,
return true;
}
-static BPXRect bpx_rect_from_layout_item(const PtexPackedLayout::Item &item)
+static BPXRect bpx_rect_from_layout_item(const BPXPackedLayout::Item &item)
{
BPXRect rect;
rect.xbegin = item.x;
@@ -970,14 +970,14 @@ static bool bpx_ptex_mesh_init(BPXPtexMesh &mesh, ImageInput &src)
static bool bpx_ptex_filter_borders_update_from_file(ImageBuf &dst,
ImageInput &src,
- PtexPackedLayout &layout)
+ BPXPackedLayout &layout)
{
BPXPtexMesh mesh;
if (!bpx_ptex_mesh_init(mesh, src)) {
return false;
}
- const PtexPackedLayout::Items &items = layout.get_items();
+ const BPXPackedLayout::Items &items = layout.get_items();
int cur_layout_item = 0;
for (int face_index = 0; face_index < mesh.num_faces; face_index++) {
@@ -986,7 +986,7 @@ static bool bpx_ptex_filter_borders_update_from_file(ImageBuf &dst,
return false;
}
- const PtexPackedLayout::Item &item = items[cur_layout_item];
+ const BPXPackedLayout::Item &item = items[cur_layout_item];
const BPXRect dst_rect = bpx_rect_from_layout_item(item);
// TODO
@@ -1005,7 +1005,7 @@ static bool bpx_ptex_filter_borders_update_from_file(ImageBuf &dst,
{
return false;
}
- const PtexPackedLayout::Item &adj_item = items[adj_layout_item];
+ const BPXPackedLayout::Item &adj_item = items[adj_layout_item];
adj_rect[side] = bpx_rect_from_layout_item(adj_item);
}
@@ -1067,12 +1067,12 @@ static bool bpx_ptex_face_vector(BPXPtexFaceSpecVec &vec, ImageInput &src)
return true;
}
-int BPX_packed_layout_num_regions(const PtexPackedLayout *layout)
+int BPX_packed_layout_num_regions(const BPXPackedLayout *layout)
{
return layout->get_items().size();
}
-static bool bpx_image_buf_ptex_layout(PtexPackedLayout &layout, ImageInput &in,
+static bool bpx_image_buf_ptex_layout(BPXPackedLayout &layout, ImageInput &in,
const BPXPtexFaceSpecVec &face_specs)
{
ImageSpec spec = in.spec();
@@ -1084,11 +1084,11 @@ static bool bpx_image_buf_ptex_layout(PtexPackedLayout &layout, ImageInput &in,
const BPXPtexFaceSpec &pfs = face_specs.at(subimage);
if (pfs.subface) {
- layout.add_item(PtexPackedLayout::Item(pfs.w, pfs.h));
+ layout.add_item(BPXPackedLayout::Item(pfs.w, pfs.h));
}
else {
for (int i = 0; i < QUAD_NUM_SIDES; i++) {
- layout.add_item(PtexPackedLayout::Item(pfs.qw[i], pfs.qh[i]));
+ layout.add_item(BPXPackedLayout::Item(pfs.qw[i], pfs.qh[i]));
}
}
@@ -1105,7 +1105,7 @@ static bool bpx_image_buf_ptex_layout(PtexPackedLayout &layout, ImageInput &in,
}
static bool bpx_image_buf_fill_from_layout(ImageBuf &all_dst,
- const PtexPackedLayout &layout,
+ const BPXPackedLayout &layout,
const BPXPtexFaceSpecVec &face_specs,
ImageInput &src)
{
@@ -1124,7 +1124,7 @@ static bool bpx_image_buf_fill_from_layout(ImageBuf &all_dst,
src.read_image(src.spec().format, tmp.localpixels());
if (pfs.subface) {
- const PtexPackedLayout::Item &item =
+ const BPXPackedLayout::Item &item =
layout.get_items().at(face_id);
const int xbegin = item.x;
const int ybegin = item.y;
@@ -1148,7 +1148,7 @@ static bool bpx_image_buf_fill_from_layout(ImageBuf &all_dst,
ROI dst_roi[QUAD_NUM_SIDES];
for (int i = 0; i < QUAD_NUM_SIDES; i++) {
- const PtexPackedLayout::Item &item =
+ const BPXPackedLayout::Item &item =
layout.get_items().at(face_id);
ImageSpec spec2 = spec;
spec2.width = pfs.qw[i];
@@ -1188,7 +1188,7 @@ BPXImageBuf *BPX_image_buf_ptex_pack(BPXImageInput *bpx_src,
return NULL;
}
- PtexPackedLayout layout(face_specs.size());
+ BPXPackedLayout layout(face_specs.size());
if (!bpx_image_buf_ptex_layout(layout, in, face_specs)) {
return NULL;
}
@@ -1210,39 +1210,39 @@ BPXImageBuf *BPX_image_buf_ptex_pack(BPXImageInput *bpx_src,
return bpx_dst;
}
-PtexPackedLayout *ptex_packed_layout_new(const int count)
+BPXPackedLayout *BPX_packed_layout_new(const int count)
{
- return new PtexPackedLayout(count);
+ return new BPXPackedLayout(count);
}
-void ptex_packed_layout_add(PtexPackedLayout * const layout,
+void BPX_packed_layout_add(BPXPackedLayout * const layout,
const int u_res, const int v_res,
const int id)
{
- layout->add_item(PtexPackedLayout::Item(u_res, v_res));
+ layout->add_item(BPXPackedLayout::Item(u_res, v_res));
}
-void ptex_packed_layout_finalize(PtexPackedLayout * const layout)
+void BPX_packed_layout_finalize(BPXPackedLayout * const layout)
{
layout->finalize();
}
-int ptex_packed_layout_width(const PtexPackedLayout * const layout)
+int BPX_packed_layout_width(const BPXPackedLayout * const layout)
{
return layout->get_width();
}
-int ptex_packed_layout_height(const PtexPackedLayout * const layout)
+int BPX_packed_layout_height(const BPXPackedLayout * const layout)
{
return layout->get_height();
}
-bool ptex_packed_layout_item(const PtexPackedLayout * const layout,
+bool BPX_packed_layout_item(const BPXPackedLayout * const layout,
const int item_id, int *x, int *y,
int *width, int *height)
{
if (layout && x && y && width && height) {
- const PtexPackedLayout::Items &items = layout->get_items();
+ const BPXPackedLayout::Items &items = layout->get_items();
if (item_id >= 0 && item_id < items.size()) {
(*x) = items[item_id].x;
(*y) = items[item_id].y;
@@ -1254,7 +1254,7 @@ bool ptex_packed_layout_item(const PtexPackedLayout * const layout,
return false;
}
-void ptex_packed_layout_delete(PtexPackedLayout *layout)
+void BPX_packed_layout_delete(BPXPackedLayout *layout)
{
delete layout;
}
diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp
index 25ed364..2651c86 100644
--- a/intern/cycles/render/image.cpp
+++ b/intern/cycles/render/image.cpp
@@ -391,12 +391,12 @@ struct PtexPackUcharContext {
int slot;
};
-static BPXImageBuf *ptex_pack_uchar_cb(const struct PtexPackedLayout *layout,
+static BPXImageBuf *ptex_pack_uchar_cb(const struct BPXPackedLayout *layout,
void *c)
{
PtexPackUcharContext &context = *static_cast<PtexPackUcharContext*>(c);
- const int width = ptex_packed_layout_width(layout
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list