[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15294] branches/apricot/source: Apricot Branch: GLSL

2008-06-21 Thread Brecht Van Lommel
Revision: 15294
  
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=15294
Author:   blendix
Date: 2008-06-21 12:33:12 +0200 (Sat, 21 Jun 2008)

Log Message:
---
Apricot Branch: GLSL


* Added initial support for shadow buffers, works in the 3d view and the
  game engine, but has known issues still:
* Shadow buffers are made again for each 3d viewport unnecessarily.
* No filtering.
* There was a bug with some shaders going black, but can't reproduce
  it anymore?

* Added support for layer lamps, though they're still always computed
  in the shader, this needs to be optimized.
* Added support for animating lamp position/rotation in the game engine.

* Fix issue with lamps giving negative light on the backside.
* Fix issue with specular + orthographic camera.
* Fix square spotlights.
* Potential workaround for a bug in the nvidia drivers with shader linking.

Modified Paths:
--
branches/apricot/source/blender/blenkernel/intern/object.c
branches/apricot/source/blender/blenloader/intern/readfile.c
branches/apricot/source/blender/gpu/GPU_extensions.h
branches/apricot/source/blender/gpu/GPU_material.h
branches/apricot/source/blender/gpu/intern/gpu_codegen.c
branches/apricot/source/blender/gpu/intern/gpu_codegen.h
branches/apricot/source/blender/gpu/intern/gpu_extensions.c
branches/apricot/source/blender/gpu/intern/gpu_material.c
branches/apricot/source/blender/gpu/intern/material_shaders.glsl
branches/apricot/source/blender/gpu/intern/material_shaders.glsl.c
branches/apricot/source/blender/gpu/intern/material_vertex_shader.glsl
branches/apricot/source/blender/gpu/intern/material_vertex_shader.glsl.c
branches/apricot/source/blender/include/BDR_drawobject.h
branches/apricot/source/blender/include/BSE_drawview.h
branches/apricot/source/blender/makesdna/DNA_object_types.h
branches/apricot/source/blender/nodes/intern/SHD_nodes/SHD_camera.c
branches/apricot/source/blender/nodes/intern/SHD_nodes/SHD_geom.c
branches/apricot/source/blender/src/buttons_shading.c
branches/apricot/source/blender/src/drawobject.c
branches/apricot/source/blender/src/drawview.c
branches/apricot/source/blender/src/previewrender.c
branches/apricot/source/blender/src/renderwin.c
branches/apricot/source/gameengine/Converter/BL_BlenderDataConversion.cpp
branches/apricot/source/gameengine/Ketsji/BL_BlenderShader.cpp
branches/apricot/source/gameengine/Ketsji/BL_BlenderShader.h
branches/apricot/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
branches/apricot/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
branches/apricot/source/gameengine/Ketsji/KX_KetsjiEngine.h
branches/apricot/source/gameengine/Ketsji/KX_Light.cpp
branches/apricot/source/gameengine/Ketsji/KX_Light.h
branches/apricot/source/gameengine/Ketsji/KX_Scene.cpp
branches/apricot/source/gameengine/Ketsji/KX_Scene.h

Modified: branches/apricot/source/blender/blenkernel/intern/object.c
===
--- branches/apricot/source/blender/blenkernel/intern/object.c  2008-06-20 
21:36:15 UTC (rev 15293)
+++ branches/apricot/source/blender/blenkernel/intern/object.c  2008-06-21 
10:33:12 UTC (rev 15294)
@@ -112,6 +112,8 @@
 
 #include BPY_extern.h
 
+#include GPU_material.h
+
 #include blendef.h
 
 /* Local function protos */
@@ -268,6 +270,7 @@
}
if(ob-soft) sbFree(ob-soft);
if(ob-fluidsimSettings) fluidsimSettingsFree(ob-fluidsimSettings);
+   if(ob-gpulamp) GPU_lamp_free(ob-gpulamp);
 }
 
 static void unlink_object__unlinkModifierLinks(void *userData, Object *ob, 
Object **obpoin)
@@ -1215,6 +1218,7 @@
obn-vnode = NULL;
 #endif
 
+   obn-gpulamp = NULL;
 
return obn;
 }

Modified: branches/apricot/source/blender/blenloader/intern/readfile.c
===
--- branches/apricot/source/blender/blenloader/intern/readfile.c
2008-06-20 21:36:15 UTC (rev 15293)
+++ branches/apricot/source/blender/blenloader/intern/readfile.c
2008-06-21 10:33:12 UTC (rev 15294)
@@ -3368,6 +3368,7 @@
ob-bb= NULL;
ob-derivedDeform= NULL;
ob-derivedFinal= NULL;
+   ob-gpulamp= NULL;
 }
 
 /*  READ SCENE * */

Modified: branches/apricot/source/blender/gpu/GPU_extensions.h
===
--- branches/apricot/source/blender/gpu/GPU_extensions.h2008-06-20 
21:36:15 UTC (rev 15293)
+++ branches/apricot/source/blender/gpu/GPU_extensions.h2008-06-21 
10:33:12 UTC (rev 15294)
@@ -72,6 +72,7 @@
 
 GPUTexture *GPU_texture_create_1D(int w, float *pixels, int halffloat);
 GPUTexture *GPU_texture_create_2D(int w, int h, float *pixels, int halffloat);
+GPUTexture *GPU_texture_create_depth(int w, int h);

[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15295] branches/soc-2008-unclezeiv/source /blender/render/intern/source/lightcuts.c: code reorganization: now each tree has its own structure (Lightc

2008-06-21 Thread Davide Vercelli
Revision: 15295
  
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=15295
Author:   unclezeiv
Date: 2008-06-21 14:23:04 +0200 (Sat, 21 Jun 2008)

Log Message:
---
code reorganization: now each tree has its own structure (LightcutsTree)

(sorry, my editor changed a lot of whitespace as well)

Modified Paths:
--
branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c

Modified: 
branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c
===
--- branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c 
2008-06-21 10:33:12 UTC (rev 15294)
+++ branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c 
2008-06-21 12:23:04 UTC (rev 15295)
@@ -53,6 +53,17 @@
 
 #define LA_TYPE_TO_CLUSTER_TYPE(c) ((c)+1)
 
+/* = LA_X */
+#define TREE_LOCAL 0
+#define TREE_SUN   1
+#define TREE_SPOT  2
+#define _TREES_SIZE 3
+
+#define CLUSTER_TYPE_TO_ARRAY_IDX(c) ((c)-1)
+
+/* strings for guarded alloc */
+char *array_names[]= {lc_array_local, lc_array_sun, lc_array_spot};
+
 /* node of the lightcuts tree */
 typedef struct LightcutsCluster
 {
@@ -89,28 +100,28 @@
float f_clus_noshad;
 } CutNode;
 
+typedef struct LightcutsTree {
+   LightcutsCluster *array;
+   int free; /* location of first empty slot */
+   int root; /* id of root node */
+   int counter; /* number of available lights for this type */
+} LightcutsTree;
+
 typedef struct LightcutsData {
/* NOTE: conservative space estimation */
/* TODO: equivalent data structures for sun and spot */
ListBase pointlights;
-   LightcutsCluster *array_local;
-   int free_local; /* location of first empty slot */
-   int root_local; /* id of root node */
-   int counter_local;
 
+   LightcutsTree trees[_TREES_SIZE];
+
float max_local_dist; /* maximum distance for local lights */
 
-   LightcutsCluster *array_sun;
-   int free_sun; /* location of first empty slot */
-   int root_sun; /* id of root node */
-   int counter_sun;
-
int light_counter;
-   
+
float error_rate;
int max_lights;
int max_cut;
-   
+
CutNode *cut_nodes;
int cut_nodes_size;
 #ifdef LIGHTCUTS_DEBUG
@@ -133,15 +144,15 @@
 {
/* TODO: compute metric also for oriented lights */
float diff[3], min[3], max[3];
-   
+
VECCOPY(min, one-min);
VECCOPY(max, one-max);
-   
+
DO_MINMAX(two-min, min, max);
DO_MINMAX(two-max, min, max);
-   
+
VECSUB(diff, max, min);
-   
+
return (one-luminance + two-luminance) * VEC_LEN_SQ(diff);
 }
 
@@ -150,11 +161,11 @@
LightcutsCluster *one = array[minpair-first];
LightcutsCluster *two = array[minpair-second];
LightcutsCluster *dest = array[*root];
-   
+
/* mark children elements as already in tree */
one-in_tree = 1;
two-in_tree = 1;
-   
+
/* fill in the new cluster: please note that it is not yet in tree */
dest-type = array[minpair-first].type;
dest-id = *root;
@@ -165,14 +176,14 @@
 #ifdef LIGHTCUTS_DEBUG
dest-dbg_parent = -1;
one-dbg_parent = two-dbg_parent = dest-id;
-#endif 
-   
+#endif
+
/* compute new bounding box */
VECCOPY(dest-min, one-min);
VECCOPY(dest-max, one-max);
DO_MINMAX(two-min, dest-min, dest-max);
DO_MINMAX(two-max, dest-min, dest-max);
-   
+
/* the representative light is chosen randomly among children */
if (BLI_frand() * (one-luminance + two-luminance)  one-luminance) {
dest-lar= one-lar;
@@ -183,7 +194,7 @@
VECCOPY(dest-col, two-col);
}
dest-intensity= dest-luminance / LC_LUMINOSITY(dest-col);
-   
+
(*root)++;
 }
 
@@ -195,19 +206,19 @@
float pair_metric;
int other = -1;
int i;
-   
+
for (i = from; i  size; i++)
{
if (i == id)
continue;
-   
+
el2 = array[i];
-   
+
if (el2-type == CLUSTER_EMPTY)
break;
if (el2-in_tree)
continue;
-   
+
pair_metric = lightcuts_compute_metric(el, el2);
if (pair_metric  metric)
{
@@ -215,37 +226,37 @@
other = i;
}
}
-   
+
if (other != -1)
{
pair-first = id;
pair-second = other;
-   
+
BLI_heap_insert(heap, metric, pair);
}
 }
 
-static void lightcuts_fill_array(ListBase * pointlights, LightcutsCluster 
**array, int *n_free, int max_lights, char * name, int cur_type)
+static void 

[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15297] branches/soc-2008-nicholasbishop/ source/blender/blenkernel: Displacements over subdivided edges work correctly now ( both for display and upd

2008-06-21 Thread Nicholas Bishop
Revision: 15297
  
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=15297
Author:   nicholasbishop
Date: 2008-06-21 20:20:32 +0200 (Sat, 21 Jun 2008)

Log Message:
---
Displacements over subdivided edges work correctly now (both for display and 
updating the highest level.)

Modified Paths:
--
branches/soc-2008-nicholasbishop/source/blender/blenkernel/BKE_multires.h

branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/cdderivedmesh.c
branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/multires.c

branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/subsurf_ccg.c

Modified: 
branches/soc-2008-nicholasbishop/source/blender/blenkernel/BKE_multires.h
===
--- branches/soc-2008-nicholasbishop/source/blender/blenkernel/BKE_multires.h   
2008-06-21 14:31:38 UTC (rev 15296)
+++ branches/soc-2008-nicholasbishop/source/blender/blenkernel/BKE_multires.h   
2008-06-21 18:20:32 UTC (rev 15297)
@@ -29,7 +29,9 @@
 
 struct CustomData;
 struct EditMesh;
+struct MCol;
 struct Multires;
+struct MultiresColFace;
 struct MultiresLevel;
 struct Mesh;
 struct Object;
@@ -53,7 +55,7 @@
 void multires_delete_layer(struct Mesh *me, struct CustomData *cd, const int 
type, int n);
 void multires_add_layer(struct Mesh *me, struct CustomData *cd, const int 
type, const int n);
 void multires_del_lower_customdata(struct Multires *mr, struct MultiresLevel 
*cr_lvl);
-void multires_to_mcol(struct MultiresColFace *f, MCol mcol[4]);
+void multires_to_mcol(struct MultiresColFace *f, struct MCol *mcol);
 /* After adding or removing vcolor layers, run this */
 void multires_load_cols(struct Mesh *me);
 
@@ -69,24 +71,37 @@
 
 struct DerivedMesh;
 struct MFace;
+struct MEdge;
 
+typedef struct IndexNode {
+   struct IndexNode *next, *prev;
+   int index;
+} IndexNode;
+
+void create_vert_face_map(ListBase **map, IndexNode **mem, const struct MFace 
*mface,
+ const int totvert, const int totface);
+
 /* MultiresDM */
 struct DerivedMesh *MultiresDM_new(struct DerivedMesh*, int, int, int, int, 
int);
 void *MultiresDM_get_orco(struct DerivedMesh *);
 void *MultiresDM_get_subco(struct DerivedMesh *);
 struct MFace *MultiresDM_get_orfa(struct DerivedMesh *);
+struct MEdge *MultiresDM_get_ored(struct DerivedMesh *);
+struct ListBase *MultiresDM_get_vert_face_map(struct DerivedMesh *);
 int MultiresDM_get_totlvl(struct DerivedMesh *);
 int MultiresDM_get_lvl(struct DerivedMesh *);
 int MultiresDM_get_totorfa(struct DerivedMesh *);
+int MultiresDM_get_totored(struct DerivedMesh *);
 void MultiresDM_set_update(struct DerivedMesh *, void (*)(struct 
DerivedMesh*));
 
 /* Modifier */
 struct MDisps;
+struct MFace;
 struct MultiresModifierData;
 typedef struct MultiresDisplacer {
struct MDisps *grid;
+   struct MFace *face;
float mat[3][3];
-   int sides;
int spacing;
int sidetot;
int sidendx;
@@ -94,6 +109,7 @@
int invert;
float (*orco)[3];
float (*subco)[3];
+   float weight;
 
int x, y, ax, ay;
 } MultiresDisplacer;
@@ -104,7 +120,9 @@
 void multiresModifier_setLevel(void *mmd_v, void *ob_v);
 
 void multires_displacer_init(MultiresDisplacer *d, struct DerivedMesh *dm,
-const int face_index, const int sides, const int 
invert);
+const int face_index, const int invert);
+void multires_displacer_weight(MultiresDisplacer *d, const float w);
 void multires_displacer_anchor(MultiresDisplacer *d, const int type, const int 
side_index);
+void multires_displacer_anchor_edge(MultiresDisplacer *d, const int, const 
int, const int);
 void multires_displacer_jump(MultiresDisplacer *d);
 void multires_displace(MultiresDisplacer *d, float out[3]);

Modified: 
branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/cdderivedmesh.c
===
--- 
branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/cdderivedmesh.c
   2008-06-21 14:31:38 UTC (rev 15296)
+++ 
branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/cdderivedmesh.c
   2008-06-21 18:20:32 UTC (rev 15297)
@@ -42,6 +42,7 @@
 #include BKE_displist.h
 #include BKE_global.h
 #include BKE_mesh.h
+#include BKE_multires.h
 #include BKE_utildefines.h
 
 #include BLI_arithb.h
@@ -1148,9 +1149,15 @@
int lvl, totlvl;
float (*orco)[3];
float (*subco)[3];
+   MEdge *ored;
MFace *orfa;
+   int totorco;
+   int totored;
int totorfa;
 
+   ListBase *vert_face_map;
+   IndexNode *vert_face_map_mem;
+
void (*update)(DerivedMesh*);
 } MultiresDM;
 
@@ -1163,9 +1170,14 @@
mrdm-update(dm);
 
if(DM_release(dm)) {
+   MEM_freeN(mrdm-ored);
MEM_freeN(mrdm-orfa);
 

[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15298] branches/soc-2008-nicholasbishop/ source/blender/blenkernel: Vertices in the base mesh now get displaced.

2008-06-21 Thread Nicholas Bishop
Revision: 15298
  
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=15298
Author:   nicholasbishop
Date: 2008-06-21 22:21:31 +0200 (Sat, 21 Jun 2008)

Log Message:
---
Vertices in the base mesh now get displaced.

Modified Paths:
--
branches/soc-2008-nicholasbishop/source/blender/blenkernel/BKE_multires.h

branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/cdderivedmesh.c
branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/multires.c

branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/subsurf_ccg.c

Modified: 
branches/soc-2008-nicholasbishop/source/blender/blenkernel/BKE_multires.h
===
--- branches/soc-2008-nicholasbishop/source/blender/blenkernel/BKE_multires.h   
2008-06-21 18:20:32 UTC (rev 15297)
+++ branches/soc-2008-nicholasbishop/source/blender/blenkernel/BKE_multires.h   
2008-06-21 20:21:31 UTC (rev 15298)
@@ -91,6 +91,7 @@
 int MultiresDM_get_totlvl(struct DerivedMesh *);
 int MultiresDM_get_lvl(struct DerivedMesh *);
 int MultiresDM_get_totorfa(struct DerivedMesh *);
+int MultiresDM_get_totorco(struct DerivedMesh *);
 int MultiresDM_get_totored(struct DerivedMesh *);
 void MultiresDM_set_update(struct DerivedMesh *, void (*)(struct 
DerivedMesh*));
 
@@ -124,5 +125,6 @@
 void multires_displacer_weight(MultiresDisplacer *d, const float w);
 void multires_displacer_anchor(MultiresDisplacer *d, const int type, const int 
side_index);
 void multires_displacer_anchor_edge(MultiresDisplacer *d, const int, const 
int, const int);
+void multires_displacer_anchor_vert(MultiresDisplacer *d, const int);
 void multires_displacer_jump(MultiresDisplacer *d);
 void multires_displace(MultiresDisplacer *d, float out[3]);

Modified: 
branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/cdderivedmesh.c
===
--- 
branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/cdderivedmesh.c
   2008-06-21 18:20:32 UTC (rev 15297)
+++ 
branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/cdderivedmesh.c
   2008-06-21 20:21:31 UTC (rev 15298)
@@ -1241,6 +1241,11 @@
 
 }
 
+int MultiresDM_get_totorco(struct DerivedMesh *dm)
+{
+   return ((MultiresDM*)dm)-totorco;
+}
+
 void *MultiresDM_get_subco(DerivedMesh *dm)
 {
return ((MultiresDM*)dm)-subco;

Modified: 
branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/multires.c
===
--- 
branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/multires.c
2008-06-21 18:20:32 UTC (rev 15297)
+++ 
branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/multires.c
2008-06-21 20:21:31 UTC (rev 15298)
@@ -1536,6 +1536,20 @@
}
 }
 
+void multires_displacer_anchor_vert(MultiresDisplacer *d, const int v)
+{
+   const int e = d-sidetot - 1;
+   d-x = d-y = 0;
+   if(v == d-face-v2)
+   d-x = e;
+   else if(v == d-face-v3)
+   d-x = d-y = e;
+   else if(v == d-face-v4)
+   d-y = e;
+
+   d-type = 5;
+}
+
 void multires_displacer_jump(MultiresDisplacer *d)
 {
if(d-sidendx == 0) {
@@ -1681,6 +1695,17 @@
++d.subco;
}
}
+   
+   for(i = 0; i  MultiresDM_get_totorco(dm); ++i) {
+   IndexNode *n;
+   for(n = map[i].first; n; n = n-next) {
+   multires_displacer_init(d, dm, n-index, 1);
+   multires_displacer_anchor_vert(d, i);
+   multires_displace(d, mvert-co);
+   }
+   ++mvert;
+   ++d.subco;
+   }
}
 }
 

Modified: 
branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/subsurf_ccg.c
===
--- 
branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/subsurf_ccg.c 
2008-06-21 18:20:32 UTC (rev 15297)
+++ 
branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/subsurf_ccg.c 
2008-06-21 20:21:31 UTC (rev 15298)
@@ -693,7 +693,23 @@
 
DM_copy_vert_data(dm, result, vertIdx, i, 1);
VecCopyf(mvert-co, ccgSubSurf_getVertData(ss, v));
+   if(mmd) {
+   int numFaces = ccgSubSurf_getVertNumFaces(ss, v);
+   int vertface;
 
+   VecCopyf(mr_orig, mvert-co);
+   mr_orig += 3;
+
+   multires_displacer_weight(d, 1.0f / numFaces);
+   for(vertface = 0; vertface  numFaces; ++vertface) {
+   CCGFace *f = ccgSubSurf_getVertFace(ss, v, 
vertface);

[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15300] branches/soc-2008-nicholasbishop/ source/blender/blenkernel/intern/multires.c: Fixed exploding vertices in the base mesh.

2008-06-21 Thread Nicholas Bishop
Revision: 15300
  
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=15300
Author:   nicholasbishop
Date: 2008-06-22 01:00:26 +0200 (Sun, 22 Jun 2008)

Log Message:
---
Fixed exploding vertices in the base mesh.

Modified Paths:
--
branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/multires.c

Modified: 
branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/multires.c
===
--- 
branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/multires.c
2008-06-21 21:56:17 UTC (rev 15299)
+++ 
branches/soc-2008-nicholasbishop/source/blender/blenkernel/intern/multires.c
2008-06-21 23:00:26 UTC (rev 15300)
@@ -1539,6 +1539,9 @@
 void multires_displacer_anchor_vert(MultiresDisplacer *d, const int v)
 {
const int e = d-sidetot - 1;
+
+   d-type = 5;
+
d-x = d-y = 0;
if(v == d-face-v2)
d-x = e;
@@ -1546,8 +1549,6 @@
d-x = d-y = e;
else if(v == d-face-v4)
d-y = e;
-
-   d-type = 5;
 }
 
 void multires_displacer_jump(MultiresDisplacer *d)
@@ -1591,7 +1592,7 @@

}
else {
-   if(d-type == 4)
+   if(d-type == 4 || d-type == 5)
VecMulf(disp, d-weight);
VecAddf(co, co, disp);
}


___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15301] branches/soc-2008-unclezeiv/source /blender/python/api2_2x: Python API: added samplingMethod attribute to Lamp.

2008-06-21 Thread Davide Vercelli
Revision: 15301
  
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=15301
Author:   unclezeiv
Date: 2008-06-22 01:55:54 +0200 (Sun, 22 Jun 2008)

Log Message:
---
Python API: added samplingMethod attribute to Lamp. This allows to change it 
to constant or QMC adaptive/halton or QMC constant/hammersley.

I'm not sure if it makes sense to add this to trunk, but I added a 
SamplingMethods dict and updated docs as well, just in case.

Modified Paths:
--
branches/soc-2008-unclezeiv/source/blender/python/api2_2x/Lamp.c
branches/soc-2008-unclezeiv/source/blender/python/api2_2x/doc/Lamp.py

Modified: branches/soc-2008-unclezeiv/source/blender/python/api2_2x/Lamp.c
===
--- branches/soc-2008-unclezeiv/source/blender/python/api2_2x/Lamp.c
2008-06-21 23:00:26 UTC (rev 15300)
+++ branches/soc-2008-unclezeiv/source/blender/python/api2_2x/Lamp.c
2008-06-21 23:55:54 UTC (rev 15301)
@@ -118,6 +118,8 @@
 #define EXPP_LAMP_COL_MAX 1.0
 #define EXPP_LAMP_FALLOFF_MIN LA_FALLOFF_CONSTANT
 #define EXPP_LAMP_FALLOFF_MAX LA_FALLOFF_SLIDERS
+#define EXPP_LAMP_SAMPLINGMETHOD_MIN LA_SAMP_CONSTANT
+#define EXPP_LAMP_SAMPLINGMETHOD_MAX LA_SAMP_HAMMERSLEY
 
 /* Raytracing settings */
 #define EXPP_LAMP_RAYSAMPLES_MIN 1
@@ -184,6 +186,7 @@
 static PyObject *Lamp_getMode( BPy_Lamp * self );
 static PyObject *Lamp_getModesConst( void );
 static PyObject *Lamp_getSamples( BPy_Lamp * self );
+static PyObject *Lamp_getSamplingMethod( BPy_Lamp * self );
 static PyObject *Lamp_getRaySamplesX( BPy_Lamp * self );
 static PyObject *Lamp_getRaySamplesY( BPy_Lamp * self );
 static PyObject *Lamp_getAreaSizeX( BPy_Lamp * self );
@@ -233,6 +236,7 @@
 static int Lamp_setType( BPy_Lamp * self, PyObject * args );
 static int Lamp_setMode( BPy_Lamp * self, PyObject * args );
 static int Lamp_setSamples( BPy_Lamp * self, PyObject * args );
+static int Lamp_setSamplingMethod( BPy_Lamp * self, PyObject * args );
 static int Lamp_setRaySamplesX( BPy_Lamp * self, PyObject * args );
 static int Lamp_setRaySamplesY( BPy_Lamp * self, PyObject * args );
 static int Lamp_setAreaSizeX( BPy_Lamp * self, PyObject * args );
@@ -263,7 +267,7 @@
 /*/
 static PyMethodDef BPy_Lamp_methods[] = {
/* name, method, flags, doc */
-   
+
{getType, ( PyCFunction ) Lamp_getType, METH_NOARGS,
 () - return Lamp type - 'Lamp':0, 'Sun':1, 'Spot':2, 'Hemi':3, 
'Area':4, 'Photon':5},
{getMode, ( PyCFunction ) Lamp_getMode, METH_NOARGS,
@@ -438,6 +442,10 @@
 (getter)Lamp_getSamples, (setter)Lamp_setSamples,
 Lamp shadow map samples,
 NULL},
+   {samplingMethod,
+(getter)Lamp_getSamplingMethod, (setter)Lamp_setSamplingMethod,
+Lamp raytracing sampling method,
+NULL},
{raySamplesX,
 (getter)Lamp_getRaySamplesX, (setter)Lamp_setRaySamplesX,
 Lamp raytracing samples on the X axis,
@@ -807,13 +815,31 @@
return Falloffs;
 }
 
+static PyObject *Lamp_SamplingMethodsDict( void )
+{  /* create the Blender.Lamp.SamplingMethods constant 
dict */
+   PyObject *SamplingMethods = PyConstant_New(  );
+
+   if( SamplingMethods ) {
+   BPy_constant *c = ( BPy_constant * ) SamplingMethods;
+
+   PyConstant_Insert( c, CONSTANT,
+PyInt_FromLong( LA_SAMP_CONSTANT ) );
+   PyConstant_Insert( c, QMC_ADAPTIVE,
+PyInt_FromLong( LA_SAMP_HALTON ) );
+   PyConstant_Insert( c, QMC_CONSTANT,
+PyInt_FromLong( LA_SAMP_HAMMERSLEY ) );
+   }
+
+   return SamplingMethods;
+}
+
 /*/
 /* Function:  Lamp_Init  */
 /*/
 /* Needed by the Blender module, to register the Blender.Lamp submodule */
 PyObject *Lamp_Init( void )
 {
-   PyObject *submodule, *Types, *Modes, *Falloffs;
+   PyObject *submodule, *Types, *Modes, *Falloffs, *SamplingMethods;
 
if( PyType_Ready( Lamp_Type )  0)
return NULL;
@@ -821,6 +847,7 @@
Types = Lamp_TypesDict(  );
Modes = Lamp_ModesDict(  );
Falloffs = Lamp_FalloffsDict(  );
+   SamplingMethods = Lamp_SamplingMethodsDict(  );
 
submodule =
Py_InitModule3( Blender.Lamp, M_Lamp_methods, M_Lamp_doc );
@@ -831,6 +858,8 @@
PyModule_AddObject( submodule, Modes, Modes );
if( Falloffs )
PyModule_AddObject( submodule, Falloffs, Falloffs );
+   if( SamplingMethods )
+   PyModule_AddObject( submodule, SamplingMethods, 
SamplingMethods );
 

[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15302] trunk/blender/source/blender/src/ transform_generics.c: Bugfix:

2008-06-21 Thread Joshua Leung
Revision: 15302
  
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=15302
Author:   aligorith
Date: 2008-06-22 03:31:29 +0200 (Sun, 22 Jun 2008)

Log Message:
---
Bugfix:

Update-automatically option in IPO-Editor now updates objects using the active 
IPO-block as their ObAction when transforming keyframes.

Modified Paths:
--
trunk/blender/source/blender/src/transform_generics.c

Modified: trunk/blender/source/blender/src/transform_generics.c
===
--- trunk/blender/source/blender/src/transform_generics.c   2008-06-21 
23:55:54 UTC (rev 15301)
+++ trunk/blender/source/blender/src/transform_generics.c   2008-06-22 
01:31:29 UTC (rev 15302)
@@ -325,7 +325,7 @@
else {
for (base=G.scene-base.first; base; base=base-next) {
/* recalculate scale of selected nla-strips */
-   if (base-object-nlastrips.first) {
+   if (base-object  
base-object-nlastrips.first) {
Object *bob= base-object;
bActionStrip *strip;

@@ -398,8 +398,15 @@
}
}
else if(G.sipo-blocktype==ID_OB) {
+   Object *ob= OBACT;
Base *base= FIRSTBASE;

+   /* only if this if active object has this ipo 
in an action (assumes that current ipo is in action) */
+   if ((ob)  (ob-ipoflag  OB_ACTION_OB)  
(G.sipo-pin==0)) {
+   ob-ctime= -1234567.0f;
+   DAG_object_flush_update(G.scene, ob, 
OB_RECALC_OB);
+   }
+   
while(base) {
if(base-object-ipo==G.sipo-ipo) {
do_ob_ipo(base-object);


___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15304] trunk/blender/source/blender: Compiler warning fixes (part 1 or 2)

2008-06-21 Thread Joshua Leung
Revision: 15304
  
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=15304
Author:   aligorith
Date: 2008-06-22 03:56:11 +0200 (Sun, 22 Jun 2008)

Log Message:
---
Compiler warning fixes (part 1 or 2)

Modified Paths:
--
trunk/blender/source/blender/blenkernel/intern/modifier.c
trunk/blender/source/blender/include/BIF_oops.h
trunk/blender/source/blender/src/oops.c

Modified: trunk/blender/source/blender/blenkernel/intern/modifier.c
===
--- trunk/blender/source/blender/blenkernel/intern/modifier.c   2008-06-22 
01:56:06 UTC (rev 15303)
+++ trunk/blender/source/blender/blenkernel/intern/modifier.c   2008-06-22 
01:56:11 UTC (rev 15304)
@@ -1422,10 +1422,10 @@
 }
 
 static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd,
-  Object *ob,
-   DerivedMesh *dm,
-   int initFlags,
-   int axis)
+   Object *ob,
+   DerivedMesh *dm,
+   int initFlags,
+   int axis)
 {
int i;
float tolerance = mmd-tolerance;
@@ -1434,7 +1434,7 @@
int maxVerts = dm-getNumVerts(dm);
int maxEdges = dm-getNumEdges(dm);
int maxFaces = dm-getNumFaces(dm);
-   int vector_size, j, a, b;
+   int vector_size=0, j, a, b;
bDeformGroup *def, *defb;
bDeformGroup **vector_def = NULL;
int (*indexMap)[2];
@@ -1463,7 +1463,7 @@
 
if (mmd-mirror_ob) {
float obinv[4][4];
-
+   
Mat4Invert(obinv, mmd-mirror_ob-obmat);
Mat4MulMat4(mtx, ob-obmat, obinv);
Mat4Invert(imtx, mtx);
@@ -1474,16 +1474,16 @@
MVert *mv = CDDM_get_vert(result, numVerts);
int isShared;
float co[3];
-
+   
dm-getVert(dm, i, inMV);
-
+   
VecCopyf(co, inMV.co);
-
+   
if (mmd-mirror_ob) {
VecMat4MulVecfl(co, mtx, co);
}
isShared = ABS(co[axis])=tolerance;
-
+   
/* Because the topology result (# of vertices) must be the same 
if
* the mesh data is overridden by vertex cos, have to calc 
sharedness
* based on original coordinates. This is why we test before 
copy.
@@ -1491,10 +1491,10 @@
DM_copy_vert_data(dm, result, i, numVerts, 1);
*mv = inMV;
numVerts++;
-
+   
indexMap[i][0] = numVerts - 1;
indexMap[i][1] = !isShared;
-
+   
if(isShared) {
co[axis] = 0;
if (mmd-mirror_ob) {
@@ -1506,33 +1506,33 @@
} else {
MVert *mv2 = CDDM_get_vert(result, numVerts);
MDeformVert *dvert = NULL;
-
+   
DM_copy_vert_data(dm, result, i, numVerts, 1);
*mv2 = *mv;
-
+   
co[axis] = -co[axis];
if (mmd-mirror_ob) {
VecMat4MulVecfl(co, imtx, co);
}
VecCopyf(mv2-co, co);
-
+   
if (mmd-flag  MOD_MIR_VGROUP){
dvert = DM_get_vert_data(result, numVerts, 
CD_MDEFORMVERT);
-
+   
if (dvert)
{
for(j = 0; j  dvert[0].totweight; ++j)
{
char tmpname[32];
-
+   
if(dvert-dw[j].def_nr  0 ||
   dvert-dw[j].def_nr = 
vector_size)
continue;
-
+   
def = 
vector_def[dvert-dw[j].def_nr];
strcpy(tmpname, def-name);
vertgroup_flip_name(tmpname,0);
-
+   
for(b = 0, defb = 
ob-defbase.first; defb;
defb = defb-next, b++)
{
@@ -1545,7 +1545,7 @@
}
}
}
-
+   
numVerts++;
}
}
@@ -1553,25 +1553,25 @@
for(i = 0; i  maxEdges; i++) {
  

[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15303] branches/soc-2008-unclezeiv/source /blender/render/intern/source/lightcuts.c: - tree creation time now printed on standard output

2008-06-21 Thread Davide Vercelli
Revision: 15303
  
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=15303
Author:   unclezeiv
Date: 2008-06-22 03:56:06 +0200 (Sun, 22 Jun 2008)

Log Message:
---
- tree creation time now printed on standard output
- the tree building phase is now also mentioned in the infostring

Modified Paths:
--
branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c

Modified: 
branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c
===
--- branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c 
2008-06-22 01:31:29 UTC (rev 15302)
+++ branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c 
2008-06-22 01:56:06 UTC (rev 15303)
@@ -38,6 +38,7 @@
 #include DNA_lamp_types.h
 #include DNA_listBase.h
 #include MEM_guardedalloc.h
+#include PIL_time.h
 #include RE_pipeline.h
 
 #include blendef.h
@@ -131,6 +132,9 @@
int stat_samples;
int stat_cut_size;
int stat_rays_shot;
+   
+   double start_time;
+   double tree_creation_time;
 } LightcutsData;
 
 #define VEC_LEN_SQ(v) (v[0]*v[0] + v[1]*v[1] + v[2]*v[2])
@@ -437,11 +441,15 @@
ListBase *lights = re-lights;
ListBase *pointlights;
LampRen *lar;
+   char tree_time_str[12]; /* length 12 required by BLI_timestr */
 
 #ifdef LIGHTCUTS_CURRENTLY_UNUSED
LampRen *larnew;
float r, g, b, n;
 #endif
+   
+   re-i.infostr= Initializing Lightcuts;
+   re-stats_draw(re-i);
 
re-lcdata = lcd = MEM_callocN(sizeof(LightcutsData), LightcutsData);
pointlights= lcd-pointlights;
@@ -535,6 +543,10 @@
lcd-max_lights= lcd-light_counter;
lcd-error_rate= re-r.lightcuts_max_error;
lcd-max_cut= MIN2(re-r.lightcuts_max_cut, lcd-light_counter);
+   lcd-start_time= PIL_check_seconds_timer();
+   
+   re-i.infostr= Building light trees;
+   re-stats_draw(re-i);
 
/* build LA_LOCAL tree */
if (lcd-trees[TREE_LOCAL].counter  0) {
@@ -549,9 +561,16 @@
printf(Lightcuts: directional (Sun) lights tree built - );
lightcuts_build_tree(lcd-trees[TREE_SUN]);
}
+   
+   lcd-tree_creation_time= PIL_check_seconds_timer() - lcd-start_time;
+   BLI_timestr(lcd-tree_creation_time, tree_time_str);
+   printf(Tree creation time: %12s\n, tree_time_str);
 
lcd-cut_nodes_size= (lcd-max_lights * 2 + 1);
lcd-cut_nodes= MEM_callocN(sizeof(CutNode) * lcd-cut_nodes_size * 
re-r.threads, cut_nodes);
+   
+   re-i.infostr= NULL;
+   re-stats_draw(re-i);
 }
 
 /* Adapted from Transforming Axis-Aligned Bounding Boxes by Jim Arvo, 
Graphics Gems, Academic Press, 1990 */


___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15305] branches/soc-2008-unclezeiv: svn merge -r 15269:15303 https://svn.blender.org/svnroot/bf-blender/trunk/ blender

2008-06-21 Thread Davide Vercelli
Revision: 15305
  
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=15305
Author:   unclezeiv
Date: 2008-06-22 04:08:46 +0200 (Sun, 22 Jun 2008)

Log Message:
---
svn merge -r 15269:15303 
https://svn.blender.org/svnroot/bf-blender/trunk/blender

Modified Paths:
--
branches/soc-2008-unclezeiv/release/scripts/vrml97_export.py
branches/soc-2008-unclezeiv/source/blender/python/api2_2x/Mathutils.c
branches/soc-2008-unclezeiv/source/blender/src/buttons_logic.c
branches/soc-2008-unclezeiv/source/blender/src/transform_generics.c
branches/soc-2008-unclezeiv/source/blender/src/transform_snap.c
branches/soc-2008-unclezeiv/source/gameengine/Converter/BL_ShapeDeformer.cpp
branches/soc-2008-unclezeiv/source/gameengine/Converter/BL_SkinDeformer.cpp
branches/soc-2008-unclezeiv/source/gameengine/Ketsji/KX_GameObject.cpp
branches/soc-2008-unclezeiv/source/gameengine/PyDoc/KX_GameObject.py

Modified: branches/soc-2008-unclezeiv/release/scripts/vrml97_export.py
===
--- branches/soc-2008-unclezeiv/release/scripts/vrml97_export.py
2008-06-22 01:56:11 UTC (rev 15304)
+++ branches/soc-2008-unclezeiv/release/scripts/vrml97_export.py
2008-06-22 02:08:46 UTC (rev 15305)
@@ -3,9 +3,6 @@
 Name: 'VRML97 (.wrl)...'
 Blender: 241
 Group: 'Export'
-Submenu: 'All Objects...' all
-Submenu: 'All Objects compressed...' comp
-Submenu: 'Selected Objects...' selected
 Tooltip: 'Export to VRML97 file (.wrl)'
 
 
@@ -55,7 +52,7 @@
 
 import Blender
 from Blender import Object, Mesh, Lamp, Draw, BGL, \
-Image, Text, sys, Mathutils
+Image, Text, sys, Mathutils, Registry
 from Blender.Scene import Render
 
 import math
@@ -70,8 +67,9 @@
 filename = Blender.Get('filename')
 _safeOverwrite = True
 extension = ''
-ARG=''
 
+# Matrices below are used only when export_rotate_z_to_y.val:
+#
 # Blender is Z up, VRML is Y up, both are right hand coordinate
 # systems, so to go from Blender coords to VRML coords we rotate
 # by 90 degrees around the X axis. In matrix notation, we have a
@@ -456,6 +454,8 @@
if mat:
if (mat.mode  
Blender.Material.Modes['VCOL_PAINT']):
self.vcolors = 1
+   else:
+   self.vcolors = 0

# check if object is wireframe only
if ob.drawType == Blender.Object.DrawTypes.WIRE:
@@ -633,8 +633,9 @@
meshVertexList = me.verts
 
for vertex in meshVertexList:
-   blenvert = Mathutils.Vector(vertex.co)
-   vrmlvert = M_blen2vrml * blenvert
+   vrmlvert = blenvert = Mathutils.Vector(vertex.co)
+   if export_rotate_z_to_y.val:
+   vrmlvert = M_blen2vrml * vrmlvert
self.writeUnindented(%s %s %s\n  % \
 (vrmlvert[0], \
  vrmlvert[1], \
@@ -730,8 +731,8 @@
 
round(uv[1], self.tp))
j=j+1
indexStr += -1
-   texIndexList.append(indexStr)
-   texCoordList.append(coordStr)
+   texIndexList.append(indexStr)
+   texCoordList.append(coordStr)
 
self.writeIndented(texCoord TextureCoordinate {\n, 1)
self.writeIndented(point [\n, 1)
@@ -1016,7 +1017,10 @@
return
 
ob_matrix = Mathutils.Matrix(ob.getMatrix('worldspace'))
-   matrix = M_blen2vrml * ob_matrix * M_vrml2blen
+   if export_rotate_z_to_y.val:
+   matrix = M_blen2vrml * ob_matrix * M_vrml2blen
+   else:
+   matrix = ob_matrix
e  = matrix.rotationPart().toEuler()
 
v = matrix.translationPart()
@@ -1089,7 +1093,7 @@
self.writeFog()
self.proto = 0
allObj = []
-   if ARG == 'selected':
+   if export_selection_only.val:
allObj = list(scene.objects.context)
else:
allObj = list(scene.objects)
@@ -1098,7 +1102,7 @@
for thisObj in allObj:
self.writeObject(thisObj)
 
-   if ARG != 'selected':
+   if not export_selection_only.val:
self.writeScript()
self.cleanup()
 
@@ -1213,26 +1217,54 @@
wrlexport=VRML2Export(filename)