Revision: 15054
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15054
Author:   nicholasbishop
Date:     2008-05-30 03:02:40 +0200 (Fri, 30 May 2008)

Log Message:
-----------
== Multires ==

* Added an MDisps customdata layer to store multires displacements in

Modified Paths:
--------------
    
branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/customdata.c
    
branches/soc-2008-nicholasbishop/source/blender/makesdna/DNA_customdata_types.h
    
branches/soc-2008-nicholasbishop/source/blender/makesdna/DNA_meshdata_types.h

Modified: 
branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/customdata.c
===================================================================
--- 
branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/customdata.c  
    2008-05-29 22:14:12 UTC (rev 15053)
+++ 
branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/customdata.c  
    2008-05-30 01:02:40 UTC (rev 15054)
@@ -357,6 +357,29 @@
        for(i = 0; i < count; i++)
                osf[i] = default_osf;
 }
+
+void layerCopy_mdisps(const void *source, void *dest, int count)
+{
+       int i;
+       MDisps *s = source, *d = dest;
+
+       for(i = 0; i < count; ++i) {
+               if(s[i].disps)
+                       d[i].disps = MEM_dupallocN(s[i].disps);
+       }
+}
+
+void layerFree_mdisps(void *data, int count, int size)
+{
+       int i;
+       MDisps *d = data;
+
+       for(i = 0; i < count; ++i) {
+               if(d->disps)
+                       MEM_freeN(d->disps);
+       }
+}
+
 /* --------- */
 
 
@@ -454,13 +477,15 @@
        {sizeof(MStringProperty), 
"MStringProperty",1,"String",NULL,NULL,NULL,NULL},
        {sizeof(OrigSpaceFace), "OrigSpaceFace", 1, "UVTex", 
layerCopy_origspace_face, NULL,
         layerInterp_origspace_face, layerSwap_origspace_face, 
layerDefault_origspace_face},
-       {sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL}
+       {sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
+       {sizeof(MDisps), "MDisps", 1, NULL, layerCopy_mdisps,
+        layerFree_mdisps, NULL, NULL, NULL}
 };
 
 const char *LAYERTYPENAMES[CD_NUMTYPES] = {
        "CDMVert", "CDMSticky", "CDMDeformVert", "CDMEdge", "CDMFace", 
"CDMTFace",
        "CDMCol", "CDOrigIndex", "CDNormal", "CDFlags","CDMFloatProperty",
-       "CDMIntProperty","CDMStringProperty", "CDOrigSpace", "CDOrco"};
+       "CDMIntProperty","CDMStringProperty", "CDOrigSpace", "CDOrco", 
"CDMDisps"};
 
 const CustomDataMask CD_MASK_BAREMESH =
        CD_MASK_MVERT | CD_MASK_MEDGE | CD_MASK_MFACE;

Modified: 
branches/soc-2008-nicholasbishop/source/blender/makesdna/DNA_customdata_types.h
===================================================================
--- 
branches/soc-2008-nicholasbishop/source/blender/makesdna/DNA_customdata_types.h 
    2008-05-29 22:14:12 UTC (rev 15053)
+++ 
branches/soc-2008-nicholasbishop/source/blender/makesdna/DNA_customdata_types.h 
    2008-05-30 01:02:40 UTC (rev 15054)
@@ -66,7 +66,8 @@
 #define CD_PROP_STR            12
 #define CD_ORIGSPACE   13 /* for modifier stack face location mapping */
 #define CD_ORCO                        14
-#define CD_NUMTYPES            15
+#define CD_MDISPS              15
+#define CD_NUMTYPES            16
 
 /* Bits for CustomDataMask */
 #define CD_MASK_MVERT          (1 << CD_MVERT)
@@ -84,6 +85,7 @@
 #define CD_MASK_PROP_STR       (1 << CD_PROP_STR)
 #define CD_MASK_ORIGSPACE      (1 << CD_ORIGSPACE)
 #define CD_MASK_ORCO           (1 << CD_ORCO)
+#define CD_MASK_MDISPS         (1 << CD_MDISPS)
 
 
 /* CustomData.flag */

Modified: 
branches/soc-2008-nicholasbishop/source/blender/makesdna/DNA_meshdata_types.h
===================================================================
--- 
branches/soc-2008-nicholasbishop/source/blender/makesdna/DNA_meshdata_types.h   
    2008-05-29 22:14:12 UTC (rev 15053)
+++ 
branches/soc-2008-nicholasbishop/source/blender/makesdna/DNA_meshdata_types.h   
    2008-05-30 01:02:40 UTC (rev 15054)
@@ -100,6 +100,10 @@
        float uv[4][2];
 } OrigSpaceFace;
 
+typedef struct MDisps {
+       float (*disps)[3];
+} MDisps;
+
 /* Multiresolution modeling */
 typedef struct MultiresCol {
        float a, r, g, b;


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to