[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12291] branches/qdune/blender/extern/ qdune: Replaced the subdivision data files by a single cpp file that contains
Alfredo de Greef
eeshlo at yahoo.com
Fri Oct 19 00:34:16 CEST 2007
Revision: 12291
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12291
Author: eeshlo
Date: 2007-10-19 00:34:15 +0200 (Fri, 19 Oct 2007)
Log Message:
-----------
Replaced the subdivision data files by a single cpp file that contains
the values as a double array. This includes the precalculated values.
Modified Paths:
--------------
branches/qdune/blender/extern/qdune/primitives/CCSubdivision.cpp
Removed Paths:
-------------
branches/qdune/blender/extern/qdune/ccdata50.dat
branches/qdune/blender/extern/qdune/ccdata50NT.dat
branches/qdune/blender/extern/qdune/primitives/ccdata50.dat.cpp
branches/qdune/blender/extern/qdune/primitives/ccdata50NT.dat.cpp
Deleted: branches/qdune/blender/extern/qdune/ccdata50.dat
===================================================================
(Binary files differ)
Deleted: branches/qdune/blender/extern/qdune/ccdata50NT.dat
===================================================================
(Binary files differ)
Modified: branches/qdune/blender/extern/qdune/primitives/CCSubdivision.cpp
===================================================================
--- branches/qdune/blender/extern/qdune/primitives/CCSubdivision.cpp 2007-10-18 21:47:55 UTC (rev 12290)
+++ branches/qdune/blender/extern/qdune/primitives/CCSubdivision.cpp 2007-10-18 22:34:15 UTC (rev 12291)
@@ -58,8 +58,7 @@
/// but are probably in fact simpler than that, possibly a bilinear patch)
// externs
-extern char datatoc_ccdata50_dat[];
-extern char datatoc_ccdata50NT_dat[];
+extern double ccdata50[];
#include "CCSubdivision.h"
@@ -2107,7 +2106,6 @@
// JS_SDPatch
// init static vars
-double* JS_SDPatch::ccdata = NULL;
JS_SDPatch::EigenStruct* JS_SDPatch::eigen = NULL;
unsigned int JS_SDPatch::data_refc = 0;
bool JS_SDPatch::prerender = true;
@@ -2119,33 +2117,7 @@
// all patches have been fully processed at the prerender stage.
void JS_SDPatch::getSubdivData()
{
- // endianess test
- unsigned int et = 0;
- ((char*)&et)[0] = 1;
- char *datatoc_ccdata;
-
- if (et == 1)
- datatoc_ccdata = datatoc_ccdata50NT_dat;
- else
- datatoc_ccdata = datatoc_ccdata50_dat;
-
- int Nmax;
- memcpy(&Nmax, datatoc_ccdata, sizeof(int));
- // expecting Nmax==50
- if (Nmax != 50) { // should never happen
- printf("[ERROR] -> JS_SDPatch::getCCData(): Unexpected value for Nmax in subdivision data -> %d\n", Nmax);
- exit(1);
- }
- int totdoubles = 0;
- for (int i=0; i<Nmax-2; i++) {
- const int N = i+3;
- const int K = 2*N + 8;
- totdoubles += K + K*K + 3*K*16;
- }
- ccdata = new double[totdoubles];
- memcpy(ccdata, datatoc_ccdata+sizeof(int), sizeof(double)*totdoubles);
-
- // now set the actual EigenStructs as pointers to data in array
+ // set the actual EigenStructs as pointers to data in array
eigen = new EigenStruct[48];
int ofs1 = 0;
for (int i=0; i<48; i++) {
@@ -2154,47 +2126,13 @@
const int ofs3 = ofs2 + K*K;
const int ofs4 = ofs3 + K*16;
const int ofs5 = ofs4 + K*16;
- eigen[i].L = ccdata + ofs1;
- eigen[i].iV = ccdata + ofs2;
- eigen[i].x[0] = ccdata + ofs3;
- eigen[i].x[1] = ccdata + ofs4;
- eigen[i].x[2] = ccdata + ofs5;
+ eigen[i].L = ccdata50 + ofs1;
+ eigen[i].iV = ccdata50 + ofs2;
+ eigen[i].x[0] = ccdata50 + ofs3;
+ eigen[i].x[1] = ccdata50 + ofs4;
+ eigen[i].x[2] = ccdata50 + ofs5;
ofs1 = ofs5 + K*16;
}
-
- // make bspline evaluation basis
- double buv[16][16];
- memset(buv, 0, sizeof(double)*16*16);
- // bspline basis (could use RiBSplineBasis, but want double prec by default)
- double bsp[4][4] = {{-1.0/6.0, 0.5, -0.5, 1.0/6.0},
- { 0.5, -1.0, 0.5, 0.0},
- { -0.5, 0.0, 0.5, 0.0},
- { 1.0/6.0, 4.0/6.0, 1.0/6.0, 0.0}};
- for (int i=0; i<16; i++) {
- const int d = i >> 2, r = i & 3;
- for (int v=0; v<4; v++)
- for (int u=0; u<4; u++)
- buv[i][v*4 + u] = bsp[u][d]*bsp[v][r];
- }
- double tmp[1728]; // max size needed for N==50
- for (int rn=0; rn<Nmax-2; rn++) {
- const int K = 2*(rn + 3) + 8;
- for (int k=0; k<3; k++) {
- memset(tmp, 0, sizeof(double)*K*16);
- int idx = 0;
- for (int i=0; i<K; i++) {
- for (int j=0; j<16; j++) {
- double sc = eigen[rn].x[k][i + j*K]; // x==Phi here
- for (int y4=0; y4<16; y4+=4)
- for (int x=0; x<4; x++)
- tmp[idx + y4 + x] += sc*buv[j][y4 + x];
- }
- idx += 16;
- }
- // now replace 'Phi' by tmp array
- memcpy(const_cast<double*>(&eigen[rn].x[k][0]), tmp, sizeof(double)*K*16);
- }
- }
}
@@ -2234,7 +2172,6 @@
}
// delete subdivision data when last patch processed
if ((--data_refc == 0) && !prerender) {
- if (ccdata) { delete[] ccdata; ccdata = NULL; }
if (eigen) { delete[] eigen; eigen = NULL; }
}
}
Deleted: branches/qdune/blender/extern/qdune/primitives/ccdata50.dat.cpp
===================================================================
--- branches/qdune/blender/extern/qdune/primitives/ccdata50.dat.cpp 2007-10-18 21:47:55 UTC (rev 12290)
+++ branches/qdune/blender/extern/qdune/primitives/ccdata50.dat.cpp 2007-10-18 22:34:15 UTC (rev 12291)
@@ -1,89739 +0,0 @@
-/* DataToC output of file <ccdata50_dat> */
-
-int datatoc_ccdata50_dat_size= 2871428;
-char datatoc_ccdata50_dat[]= {
- 0, 0, 0, 50,
- 63,240, 0, 0, 0, 0, 0, 0, 63,218, 63, 7,179, 75, 3, 72, 63,218, 63, 7,179, 75, 3, 72, 63,197, 85, 85, 85, 85, 85, 85,
- 63,195,129,240,153, 89,179, 8, 63,195,129,240,153, 89,179, 8, 63,192, 0, 0, 0, 0, 0, 0, 63,192, 0, 0, 0, 0, 0, 0,
- 63,176, 0, 0, 0, 0, 0, 0, 63,176, 0, 0, 0, 0, 0, 0, 63,160, 0, 0, 0, 0, 0, 0, 63,160, 0, 0, 0, 0, 0, 0,
- 63,144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63,215,255,255,255,255,255,236,188,241,128, 0, 0, 0, 0, 0,
- 60,227, 0, 0, 0, 0, 0, 0,191,220,204,204,204,204,204,193, 60,227, 0, 0, 0, 0, 0, 0,188,204, 0, 0, 0, 0, 0, 0,
- 64, 8, 0, 0, 0, 0, 0, 24, 64, 7,255,255,255,255,255,222,188,208, 0, 0, 0, 0, 0, 0, 60,240,170,170,170,185, 34, 46,
- 63,249,216,157,137,216,157,146, 63,249,216,157,137,216,157,158,192, 68,242,194, 52,247, 44, 48, 63,216, 0, 0, 0, 0, 0, 23,
- 63,197, 85, 85, 85, 70,221,234, 61,242, 59, 88, 64, 0, 0, 0, 63,228,178, 69,133,255, 24,219,188,182, 0, 0, 0, 0, 0, 0,
-189,242, 59, 85, 64, 0, 0, 0,191,228,178, 69,133,255, 24,223, 63,245, 85, 85, 85, 70,221,190, 63,245, 85, 85, 85, 70,221,248,
-191,244,255,255,255,250,168,225,191,244,255,255,255,250,168,234,191,231, 9, 19,248,169,151,120,191,231, 9, 19,248,169,151,132,
- 64, 51,174,233,253,160,239, 9,191,197, 85, 85, 85, 70,221,238, 63,165, 85, 85, 85, 70,221,208, 63,203,253, 22,130, 77,153,104,
- 63,192, 40,195,243,182, 1,242, 63,195, 51, 51, 51, 38, 46, 18, 63,214,244,195, 74, 93,211,246, 63,202,129,230,182,128,236,246,
-191,242,170,170,170,148,247,104,191,255,255,255,255,239,185,156, 61,192, 70, 92, 0, 0, 0, 0, 63,246,255,255,255,239,250,178,
-191,179,212,251,243, 66, 60, 2, 63,202,101,100,249,155, 25, 50,192, 13, 69,118, 90,100, 70, 22, 63,165, 85, 85, 85, 70,221,232,
- 63,197, 85, 85, 85,114, 68, 91, 63,225,236,112, 18, 73,151,206,191,212,178, 69,134, 20, 38, 79,188,149, 85, 85, 85,114, 68, 91,
-191,225,236,112, 18, 73,151,203, 63,212,178, 69,134, 20, 38, 62,192, 2,170,170,170,156, 51, 62, 63,245, 85, 85, 85,125, 29,255,
- 63,244,255,255,255,201,213,170,188,229, 85, 85, 85,114, 68, 91,191,205, 12,181,144, 8,153,208,191,231, 9, 19,248,214,214,187,
- 64, 44, 81, 22, 2,134,213,118,191,197, 85, 85, 85,114, 68, 91, 63,165, 85, 85, 85,114, 68, 63,189,220,120, 64,128, 0, 0, 0,
-191,208, 40,195,243,231, 81,131, 63,195, 51, 51, 51, 77, 61,113,189,231, 89,198, 64, 0, 0, 0,191,218,129,230,182,209,208,152,
-191,242,170,170,170,214, 17, 20,191,242,170,170,170,214, 17, 24,191,246,255,255,255,239,250,170,191,246,255,255,255,239,250,167,
-191,179,212,251,242,214,213,193,191,179,212,251,242,214,213,200, 64, 1,183, 16, 4, 59,229, 15, 63,165, 85, 85, 85,114, 68, 75,
- 63,197, 85, 85, 85, 70,221,236,191,225,236,112, 18,110, 14, 84,191,212,178, 69,133,234, 11,153,188,178,189,239,194,140, 0, 0,
- 63,225,236,112, 18,110, 14, 91, 63,212,178, 69,133,234, 11,137, 63,245, 85, 85, 85, 70,221,200,192, 2,170,170,170,183, 83, 42,
- 62, 8,105,154,128, 0, 0, 0, 63,244,255,255,255,250,168,217,191,231, 9, 19,248,169,151,122,191,205, 12,181,143, 83,157, 12,
- 64, 44, 81, 22, 2, 55, 76,182,191,197, 85, 85, 85, 70,221,236, 63,165, 85, 85, 85, 70,221,214,191,203,253, 22,130, 20,169, 0,
- 63,192, 40,195,244, 24,161, 48, 63,195, 51, 51, 51, 38, 46, 21,191,214,244,195, 74, 47, 32, 87, 63,202,129,230,183, 34,180, 68,
-191,255,255,255,255,234, 76,192,191,242,170,170,170,143,138,170, 63,246,255,255,255,237,241,228, 60,183,218,102,155,223, 35, 4,
- 63,202,101,100,249,156,241,233,191,179,212,251,243, 62,138,108,192, 13, 69,118, 90,100,220,226, 63,165, 85, 85, 85, 70,221,226,
- 60,146, 0, 0, 0, 0, 0, 0, 60,154, 0, 0, 0, 0, 0, 0, 60,180, 0, 0, 0, 0, 0, 0,188,133, 99,170,132, 18,234,215,
-188,112, 0, 0, 0, 0, 0, 0,188, 96, 0, 0, 0, 0, 0, 0,188,192, 0, 0, 0, 0, 0, 0, 60,182, 0, 0, 0, 0, 0, 0,
- 60,160, 0, 0, 0, 0, 0, 0,188,150, 58,168, 65, 46,173,116,188,156, 0, 0, 0, 0, 0, 0,188,168, 0, 0, 0, 0, 0, 0,
- 63,240, 0, 0, 0, 0, 0, 6,188,120, 0, 0, 0, 0, 0, 0,188,154, 94, 64,115,180, 0, 0,188,177, 0, 0, 0, 0, 0, 0,
-188,172, 32,245,180, 64, 0, 0, 60,129,102,179,232,192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60,112, 0, 0, 0, 0, 0, 0,
- 60,200, 0, 0, 0, 0, 0, 0, 63,197, 85, 85, 85, 85, 85, 54, 63,223,255,255,255,255,255,252,188, 77, 28,185, 91, 95, 26, 0,
- 60,171, 0, 0, 0, 0, 0, 0, 63,197, 85, 85, 85, 85, 85, 99,192, 8, 0, 0, 0, 0, 0, 12, 60,150, 0, 0, 0, 0, 0, 0,
- 60,150, 0, 0, 0, 0, 0, 0, 60,176, 0, 0, 0, 0, 0, 0, 60,128, 0, 0, 0, 0, 0, 0, 60,128, 0, 0, 0, 0, 0, 0,
-188,160, 0, 0, 0, 0, 0, 0,188,128, 0, 0, 0, 0, 0, 0,188,192, 0, 0, 0, 0, 0, 0, 63,229, 85, 85, 85, 85, 85, 94,
- 60,160, 0, 0, 0, 0, 0, 0,188,192, 0, 0, 0, 0, 0, 0,188,176, 0, 0, 0, 0, 0, 0,191,213, 85, 85, 85, 85, 85, 92,
- 64, 8, 0, 0, 0, 0, 0, 20,188,156, 0, 0, 0, 0, 0, 0,188,138, 0, 0, 0, 0, 0, 0,188,160, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,188,112, 0, 0, 0, 0, 0, 0, 60,128, 0, 0, 0, 0, 0, 0, 60,128, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 63,197, 85, 85, 85, 85, 85, 72,191,223,255,255,255,255,255,254, 60,192,226,230,170, 30,159, 44,
- 60,163, 0, 0, 0, 0, 0, 0, 63,197, 85, 85, 85, 85, 85, 92,191,240, 0, 0, 0, 0, 0, 24, 60,144, 0, 0, 0, 0, 0, 0,
-188,159, 0, 0, 0, 0, 0, 0,188,174, 0, 0, 0, 0, 0, 0,188,160, 0, 0, 0, 0, 0, 0, 60,146, 0, 0, 0, 0, 0, 0,
- 60,128, 0, 0, 0, 0, 0, 0,188,144, 0, 0, 0, 0, 0, 0, 63,197, 85, 85, 85, 85, 85,112,188,202, 0, 0, 0, 0, 0, 0,
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list