[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11201] branches/soc-2007-mosani/source/ blender/render/render_api: I've got a preliminary implementation of:

Aaron Moore two.a.ron at gmail.com
Tue Jul 10 02:47:38 CEST 2007


Revision: 11201
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11201
Author:   mosani
Date:     2007-07-10 02:47:38 +0200 (Tue, 10 Jul 2007)

Log Message:
-----------
I've got a preliminary implementation of:
 - get_objects
 - get_instanced_objects
 - object_is_instance
 - object_get_name
 - (the list traversal functions)

The test code currently in place is for get_instanced_objects with a
 type of RND_GEOMETRY. If you make multiple instances of various geometry and
 lights, when you toggle on the Render API button and hit render, it will
 print out the return list of that function run on the scene.

 - Aaron

Modified Paths:
--------------
    branches/soc-2007-mosani/source/blender/render/render_api/include/RND_types.h
    branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI.h
    branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI_helpers.h
    branches/soc-2007-mosani/source/blender/render/render_api/source/RND_helpers.c
    branches/soc-2007-mosani/source/blender/render/render_api/source/RND_object.c
    branches/soc-2007-mosani/source/blender/render/render_api/source/test.c

Modified: branches/soc-2007-mosani/source/blender/render/render_api/include/RND_types.h
===================================================================
--- branches/soc-2007-mosani/source/blender/render/render_api/include/RND_types.h	2007-07-09 20:42:14 UTC (rev 11200)
+++ branches/soc-2007-mosani/source/blender/render/render_api/include/RND_types.h	2007-07-10 00:47:38 UTC (rev 11201)
@@ -32,7 +32,11 @@
 struct RenderAPIScene;
 struct RenderAPIObject;
 struct RenderAPIObjectHolder;
-struct RenderAPIResult;
+struct RenderAPIObjectPointer;
+struct RenderAPILight;
+struct RenderAPIGeometry;
+struct RenderAPIResult;
+struct TemporaryData;
 
 /**
  * Structures necessary to make the Render API work.
@@ -40,50 +44,54 @@
  */
 
 typedef struct RenderAPIScene{
-	Scene *source; /* the scene to be rendered */
-	ListBase objects; /* an index of RenderAPIObjectHodlers for whole scene */
-	ListBase originals; /* a list of RenderAPIObjectHodlers, which objects
-	                       that have multiple instances refer to */
-	short instance_info; /* true if objects contains instance info */
+	Scene *source;
+
+	/* All object used in this render job, list of RenderAPIObjectHolders */
+	ListBase objects;
+
+	/* Indexes of various kinds, lists of RenderAPIObjectPointers */
+	/* indexes by type */
+	ListBase light_point;
+	ListBase light_spot;
+	ListBase light_sun;
+	ListBase light_hemi;
+	ListBase light_area;
+	ListBase geometry_polygon_mesh;
+	ListBase geometry_subdivision_surface;
+	ListBase geometry_nurb_surface;
+	ListBase geometry_metaball;
+	ListBase geometry_curve;
+	ListBase geometry_particle_system;
+	/* other indexes */
+	ListBase originals;
+
+	/* RNDObjects that have been generated */
+	ListBase object_handlers;
 }RenderAPIScene;
 
 typedef struct RenderAPIObject{
 	struct RenderAPIObject *next, *prev;
-	ListBase holders; /* a list of RenderAPIObjectHolders for the 
-                         selected object set */
-	struct RenderAPIObjectHolder *current_object; /* is listed within the 
-	                                                 objects list */
+	ListBase list;
+	struct RenderAPIObjectPointer *current;
 }RenderAPIObject;
 
-/** 
-    Since blender's database is hierarchical,
-    this is used to hold meta data for a single
-    object so that the list structure RNDObject
-    may flatten this hierarchy into a list.
-
-    Note: I have members which may look like
-    simple copies from the object structure,
-    one may wonder why I don't just include a
-    pointer to that. These members often differ
-    from their Object structure equivalents, due
-    to collapsing of duplication and parenting
-    transformations, and other things.
-*/
-
 typedef struct RenderAPIObjectHolder{
-	struct RenderAPIObjectHolder *next, *prev;
-	Object *source; /* the Object struct within the blender database */
-
-	char *name;
-	int type; /* determines what the identity of data is, based on 
-	             RND_DATATYPE value. */
-	struct RenderAPIObjectHolder *original; /* the original object of which 
-	                                           this is an instance */
-	
-	float transformation[4][4]; /* the resultant transformation matrix 
-	                               after groups, parenting, duplicators */
+	struct RenderAPIObjectHolder *next, *prev; /* for listing */
+	Object *source; /* object in blender's database */
+	char name[30];
+	unsigned int type;
+	float transformation[4][4]; /* final transform matrix from
+	                               view to local coordinates */
+	struct RenderAPIObjectHolder *original; /* original instance for
+	                                           objects with multiple. */
+	struct TemporaryData *temp; /* custom user data */
 }RenderAPIObjectHolder;
 
+typedef struct RenderAPIObjectPointer{
+	struct RenderAPIObjectPointer *next, *prev;
+	struct RenderAPIObjectHolder *holder;
+}RenderAPIObjectPointer;
+
 typedef struct RenderAPILight{
 	
 }RenderAPILight;

Modified: branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI.h
===================================================================
--- branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI.h	2007-07-09 20:42:14 UTC (rev 11200)
+++ branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI.h	2007-07-10 00:47:38 UTC (rev 11201)
@@ -59,7 +59,9 @@
 #include "DNA_lamp_types.h"
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
-#include "BKE_DerivedMesh.h"
+#include "BKE_DerivedMesh.h"
+#include "DNA_curve_types.h"
+#include "DNA_ipo_types.h"
 
 /****************************************************************************/
 /********************************   Types   *********************************/
@@ -151,13 +153,11 @@
 
 typedef enum RND_DATATYPE{
 
-RND_INSTANCE = (1<<0),
-
-RND_LIGHT_POINT = (1<<1) | RND_INSTANCE,
-RND_LIGHT_SPOT = (1<<2) | RND_INSTANCE,
-RND_LIGHT_SUN = (1<<3) | RND_INSTANCE,
-RND_LIGHT_HEMI = (1<<4) | RND_INSTANCE,
-RND_LIGHT_AREA = (1<<5) | RND_INSTANCE,
+RND_LIGHT_POINT = (1<<1),
+RND_LIGHT_SPOT = (1<<2),
+RND_LIGHT_SUN = (1<<3),
+RND_LIGHT_HEMI = (1<<4),
+RND_LIGHT_AREA = (1<<5),
 RND_LIGHT = 
 	( RND_LIGHT_POINT | 
 	RND_LIGHT_SPOT | 
@@ -165,12 +165,12 @@
 	RND_LIGHT_HEMI | 
 	RND_LIGHT_AREA ),
 
-RND_GEOMETRY_POLYGON_MESH = (1<<9) | RND_INSTANCE,
-RND_GEOMETRY_SUBDIVISION_SURFACE = (1<<10) | RND_INSTANCE,
-RND_GEOMETRY_NURB_SURFACE = (1<<11) | RND_INSTANCE,
-RND_GEOMETRY_METABALL = (1<<12) | RND_INSTANCE,
-RND_GEOMETRY_CURVE = (1<<13) | RND_INSTANCE,
-RND_GEOMETRY_PARTICLE_SYSTEM = (1<<14) | RND_INSTANCE,
+RND_GEOMETRY_POLYGON_MESH = (1<<9),
+RND_GEOMETRY_SUBDIVISION_SURFACE = (1<<10),
+RND_GEOMETRY_NURB_SURFACE = (1<<11),
+RND_GEOMETRY_METABALL = (1<<12),
+RND_GEOMETRY_CURVE = (1<<13),
+RND_GEOMETRY_PARTICLE_SYSTEM = (1<<14),
 RND_GEOMETRY = 
 	( RND_GEOMETRY_POLYGON_MESH | 
 	RND_GEOMETRY_SUBDIVISION_SURFACE |
@@ -191,9 +191,9 @@
 */
 RNDObject RND_get_objects( RNDScene scene, unsigned int type );
 RNDObject RND_get_instanced_objects( RNDScene scene, unsigned int type );
-int RND_is_instance( RNDObject object );
+int RND_object_is_instance( RNDObject object );
 
-void RND_object_get_name( RNDObject object, char* name );
+char* RND_object_get_name( RNDObject object );
 RND_DATATYPE RND_object_get_type( RNDObject object );
 void RND_object_get_transformation( RNDObject object, 
 	float transformation[][4] );

Modified: branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI_helpers.h
===================================================================
--- branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI_helpers.h	2007-07-09 20:42:14 UTC (rev 11200)
+++ branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI_helpers.h	2007-07-10 00:47:38 UTC (rev 11201)
@@ -32,38 +32,49 @@
 #ifndef RENDER_API_HELPERS_H
 #define RENDER_API_HELPERS_H
 
-/* Null pointers, etc.
- */
-RNDScene RenderAPI_empty_scene();
+/* Create functions - allocate dynamic memory, initialize variables to default
+ *  values, and return handler for dynamic memory. Only sets values from a
+ *  source object
+ */
 
-/* Nulls list.first and list.last, this may already exist,
- *  but I couldn't find it.
+RNDScene RenderAPI_create_scene( Scene *scene );
+
+void RenderAPI_free_scene( RNDScene scene );
+
+RenderAPIObjectHolder* RenderAPI_create_object_holder( Object *object );
+
+/* Empty functions - same as create functions without dynamic memory. 
  */
+
 void RenderAPI_empty_list( ListBase *list );
 
-/* Initializes all data which can be a derived from object, without interacting
- *  with other objects.
- */
-RenderAPIObjectHolder *RenderAPI_initialize_object_holder( Object *object );
+/* scan scene->source, fill object holder lists with all objects that will
+ * participate in this render job. Simultaneously, index by type and instance
+ * status */
+void RenderAPI_create_object_indexes( RNDScene scene );
 
-/* Frees all render API memory for this job
- */
-void RenderAPI_free( RNDScene scene );
+/* return true if base is a rendered object */
+int RenderAPI_is_rendered( Base *base );
 
-/* Create an index of all renderable objects in this scene. Collapse
- * parenting, and duplicators. If RND_INSTANCE is specified in type, include
- * instance information. 
- */
-void RenderAPI_create_object_index( RNDScene scene, unsigned int type );
+/* creates a pointer to holder and pushes it on the end of index */
+void RenderAPI_index_type( RenderAPIObjectHolder *holder, ListBase *index );
 
-/* Returns true if object is rendered for scene
- */
-int RenderAPI_is_rendered( RNDScene scene, Base *base );
+/* runs index_type on holder where it's Lamp->type is type, and the scene
+ * contains the indexes for pushing lights */
+void RenderAPI_index_light( RenderAPIObjectHolder *holder, short type,
+	RNDScene scene );
 
-/* Creates instancing information for objects. Store orignal objects in
- *  scene->originals, and link instances from objects to them. Only searches
- *  for instances within objects.
- */
-void RenderAPI_calculate_instances( RNDScene scene, ListBase objects );
+/* appends source onto destination, leaving source unchanged. */
+void RenderAPI_copy_index( ListBase *destination, ListBase *source );
+
+/* searches for instances within RenderAPIObjectPointer list source, and
+ * when it finds them it sets their RenderAPIObjectHolder->original and pushes
+ * the ObjectPointer to the original onto destination. */
+void RenderAPI_index_instance( ListBase *destination, ListBase *source );
+
+/* allocates a new RenderAPIObjectPointer memory slot, copies original to it
+ * and returns it */
+RenderAPIObjectPointer* RenderAPI_copy_object_pointer( 
+	RenderAPIObjectPointer* original );
 
 #endif

Modified: branches/soc-2007-mosani/source/blender/render/render_api/source/RND_helpers.c
===================================================================
--- branches/soc-2007-mosani/source/blender/render/render_api/source/RND_helpers.c	2007-07-09 20:42:14 UTC (rev 11200)
+++ branches/soc-2007-mosani/source/blender/render/render_api/source/RND_helpers.c	2007-07-10 00:47:38 UTC (rev 11201)
@@ -32,172 +32,223 @@
  *  Helper functions to keep the code clean. May be reorganized eventually.
  */
 
-RNDScene RenderAPI_empty_scene(){
-	RNDScene scene = MEM_mallocN( sizeof(RenderAPIScene), "renderAPI scene" );
-	scene->source = G.scene;
-	RenderAPI_empty_list( &scene->objects );

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list