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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2005-12-01 05:09:21 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2005-12-01 05:09:21 +0300
commitd6feeb6b22cf8533d40a04f754e3acafa6e0dd1e (patch)
tree144f2e608f2e3de02882b11eb64bb0ce64b0ebcb /source/blender/src/parametrizer_intern.h
parent1eab492c4ba988b1d27d5719c231e6ebf385f45c (diff)
Orange branch commit.
This commit adds new underlying uv unwrapper code, intended to be more extensible. At the moment this has a re-implementation of LSCM. This has not been activated yet, since it doesn't add anything new. What's new is the stretch minimize tool from tuhopuu. It works by selecting some some uv's in the uv editor window, and then pressing ctrl+V. The uv's on the boundary stay fixed. More stuff will follow as I port it over & fix it.
Diffstat (limited to 'source/blender/src/parametrizer_intern.h')
-rw-r--r--source/blender/src/parametrizer_intern.h186
1 files changed, 186 insertions, 0 deletions
diff --git a/source/blender/src/parametrizer_intern.h b/source/blender/src/parametrizer_intern.h
new file mode 100644
index 00000000000..4086372e2d5
--- /dev/null
+++ b/source/blender/src/parametrizer_intern.h
@@ -0,0 +1,186 @@
+
+#ifndef __PARAMETRIZER_INTERN_H__
+#define __PARAMETRIZER_INTERN_H__
+
+/* Hash:
+ -----
+ - insert only
+ - elements are all stored in a flat linked list
+*/
+
+typedef long PHashKey;
+
+typedef struct PHashLink {
+ struct PHashLink *next;
+ PHashKey key;
+} PHashLink;
+
+typedef struct PHash {
+ PHashLink *first;
+ PHashLink **buckets;
+ int size, cursize, cursize_id;
+} PHash;
+
+PHash *phash_new(int sizehint);
+void phash_delete_with_links(PHash *ph);
+void phash_delete(PHash *ph);
+
+int phash_size(PHash *ph);
+
+void phash_insert(PHash *ph, PHashLink *link);
+PHashLink *phash_lookup(PHash *ph, PHashKey key);
+PHashLink *phash_next(PHash *ph, PHashKey key, PHashLink *link);
+
+#if 0
+ #define param_assert(condition)
+ #define param_warning(message);
+#else
+ #define param_assert(condition) \
+ if (!(condition)) \
+ { printf("Assertion %s:%d\n", __FILE__, __LINE__); abort(); }
+ #define param_warning(message) \
+ { printf("Warning %s:%d: %s\n", __FILE__, __LINE__, message);
+#endif
+
+typedef enum PBool {
+ P_TRUE = 1,
+ P_FALSE = 0
+} PBool;
+
+struct PVert;
+struct PEdge;
+struct PFace;
+struct PChart;
+struct PHandle;
+
+/* Heap */
+
+typedef struct PHeapLink {
+ void *ptr;
+ float value;
+ int index;
+} PHeapLink;
+
+typedef struct PHeap {
+ unsigned int size;
+ unsigned int bufsize;
+ PHeapLink *links;
+ PHeapLink **tree;
+} PHeap;
+
+/* Simplices */
+
+typedef struct PVert {
+ struct PVertLink {
+ struct PVert *next;
+ PHashKey key;
+ } link;
+
+ struct PEdge *edge;
+ float *co;
+ float uv[2];
+ int flag;
+
+ union PVertUnion {
+ int index; /* lscm matrix index */
+ float distortion; /* area smoothing */
+ } u;
+} PVert;
+
+typedef struct PEdge {
+ struct PEdgeLink {
+ struct PEdge *next;
+ PHashKey key;
+ } link;
+
+ struct PVert *vert;
+ struct PEdge *pair;
+ struct PEdge *next;
+ struct PFace *face;
+ float *orig_uv, old_uv[2];
+ int flag;
+
+ union PEdgeUnion {
+ PHeapLink *heaplink;
+ } u;
+} PEdge;
+
+typedef struct PFace {
+ struct PFaceLink {
+ struct PFace *next;
+ PHashKey key;
+ } link;
+
+ struct PEdge *edge;
+ int flag;
+
+ union PFaceUnion {
+ int chart; /* chart construction */
+ float area3d; /* stretch */
+ } u;
+} PFace;
+
+enum PVertFlag {
+ PVERT_PIN = 1,
+ PVERT_SELECT = 2
+};
+
+enum PEdgeFlag {
+ PEDGE_SEAM = 1,
+ PEDGE_VERTEX_SPLIT = 2,
+ PEDGE_PIN = 4,
+ PEDGE_SELECT = 8,
+ PEDGE_DONE = 16,
+ PEDGE_FILLED = 32
+};
+
+/* for flipping faces */
+#define PEDGE_VERTEX_FLAGS (PEDGE_PIN)
+
+enum PFaceFlag {
+ PFACE_CONNECTED = 1,
+ PFACE_FILLED = 2
+};
+
+/* Chart */
+
+typedef struct PChart {
+ PHash *verts;
+ PHash *edges;
+ PHash *faces;
+
+ union PChartUnion {
+ struct PChartLscm {
+ NLContext context;
+ float *abf_alpha;
+ PVert *singlepin;
+ PVert *pin1, *pin2;
+ } lscm;
+ struct PChartPack {
+ float rescale;
+ float size[2], trans[2];
+ } pack;
+ } u;
+
+ struct PHandle *handle;
+} PChart;
+
+enum PHandleState {
+ PHANDLE_STATE_ALLOCATED,
+ PHANDLE_STATE_CONSTRUCTED,
+ PHANDLE_STATE_LSCM,
+ PHANDLE_STATE_STRETCH,
+};
+
+typedef struct PHandle {
+ PChart *construction_chart;
+ PChart **charts;
+ int ncharts;
+ enum PHandleState state;
+ MemArena *arena;
+ PBool implicit;
+ RNG *rng;
+} PHandle;
+
+#endif /*__PARAMETRIZER_INTERN_H__*/
+