[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11169] branches/soc-2007-mosani/source/ blender/render: Two things:

Aaron Moore two.a.ron at gmail.com
Thu Jul 5 01:31:51 CEST 2007


Revision: 11169
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11169
Author:   mosani
Date:     2007-07-05 01:31:50 +0200 (Thu, 05 Jul 2007)

Log Message:
-----------
Two things:
 1. Setup the file structure and code organization of
    the render API, and
 2. Began coding RND_get_objects().

 I have written down the method I'm taking in implementing
  get_objects, but I haven't put it up yet. I will do that
  soon, and it will be here: http://wiki.blender.org/index.php/Render_API

Modified Paths:
--------------
    branches/soc-2007-mosani/source/blender/render/intern/source/pipeline.c
    branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI.h

Added 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_helpers.h
    branches/soc-2007-mosani/source/blender/render/render_api/source/RND_camera.c
    branches/soc-2007-mosani/source/blender/render/render_api/source/RND_context.c
    branches/soc-2007-mosani/source/blender/render/render_api/source/RND_helpers.c
    branches/soc-2007-mosani/source/blender/render/render_api/source/RND_light.c
    branches/soc-2007-mosani/source/blender/render/render_api/source/RND_object.c
    branches/soc-2007-mosani/source/blender/render/render_api/source/RND_settings.c
    branches/soc-2007-mosani/source/blender/render/render_api/source/test.c

Removed Paths:
-------------
    branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI_settings.h
    branches/soc-2007-mosani/source/blender/render/render_api/source/RenderAPI.c
    branches/soc-2007-mosani/source/blender/render/render_api/source/RenderAPI_settings.c

Modified: branches/soc-2007-mosani/source/blender/render/intern/source/pipeline.c
===================================================================
--- branches/soc-2007-mosani/source/blender/render/intern/source/pipeline.c	2007-07-04 20:08:07 UTC (rev 11168)
+++ branches/soc-2007-mosani/source/blender/render/intern/source/pipeline.c	2007-07-04 23:31:50 UTC (rev 11169)
@@ -1517,7 +1517,7 @@
 
 static void do_render_3d_with_RenderAPI(Render *re)
 {
-	RenderAPI_explore();
+	RenderAPI_test();
 }
 
 

Added: 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	                        (rev 0)
+++ branches/soc-2007-mosani/source/blender/render/render_api/include/RND_types.h	2007-07-04 23:31:50 UTC (rev 11169)
@@ -0,0 +1,89 @@
+/**
+ * RenderAPI_types.h, 4 June 2007, mosani
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2007 by someone I'm sure.
+ *
+ * Contributors: mosani
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef RENDER_API_TYPES_H
+#define RENDER_API_TYPES_H
+
+#include "RenderAPI.h"
+
+struct RenderAPIScene;
+struct RenderAPIObject;
+struct RenderAPIObjectHolder;
+struct RenderAPIResult;
+
+/**
+ * Structures necessary to make the Render API work.
+ * This file contains documentation for the DEVELOPERS of this API.
+ */
+
+typedef struct RenderAPIScene{
+	Scene *source; /* the scene to be rendered */
+	ListBase objects; /* an index of RenderAPIObjectHodlers */
+	short instance_info; /* true if objects contains instance info */
+}RenderAPIScene;
+
+typedef struct RenderAPIObject{
+	ListBase holders; /* a list of RenderAPIObjectHolders for the 
+                         selected object set */
+	struct RenderAPIObjectHolder *current_object; /* is listed within the 
+	                                                 objects list */
+}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.
+*/
+
+typedef struct RenderAPIObjectHolder{
+	struct RenderAPIObjectHolder *next;
+
+	int type; /* choose one of the following pointers, based on 
+	             RND_DATATYPE value. */
+	Lamp *lamp; /* the lamp within blender's database */
+	DerivedMesh *mesh; /* the mesh within blender's database */
+	/* ...more datatypes */
+	struct RenderAPIObjectHolder *original; /* the original object of which this is
+	                                    an instance */
+	
+	float transformation[4][4]; /* the resultant transformation matrix 
+	                               after groups, parenting, duplicators */
+}RenderAPIObjectHolder;
+
+typedef struct RenderAPILight{
+	
+}RenderAPILight;
+
+typedef struct RenderAPIGeometry{
+	
+}RenderAPIGeometry;
+
+typedef struct RenderAPIResult{
+	
+}RenderAPIResult;
+
+#endif

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-04 20:08:07 UTC (rev 11168)
+++ branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI.h	2007-07-04 23:31:50 UTC (rev 11169)
@@ -27,66 +27,218 @@
 /**
  * General System Documentation: http://wiki.blender.org/index.php/Render_API
  *
- * Note I haven't totally worked out the way I'm going to organize my code
- *  for the API. The structure of this page is temporary, but I wanted to
- *  put something here initially to show I care about such things.
+ * This file contains documentation for the USERS of this API. Documentation for
+ *  the developers is reserved for RenderAPI_helpers.h, RND_types.h, and source
+ *  files.
  */
 
 #ifndef RENDER_API_H
 #define RENDER_API_H
+/****************************************************************************/
+/*******************************   Includes   *******************************/
+/****************************************************************************/
 
-/************** Includes *****************/
-
 /* C standard */
 #include <stdio.h>
 #include <string.h>
 
-/* Outside of the render system */
+/* Outside of the render system */
+
+/* functions */
+#include "BLI_blenlib.h"
+#include "MEM_guardedalloc.h"
+
+/* structures */
 #include "BKE_global.h"
 #include "DNA_ID.h"
 #include "DNA_listBase.h"
 #include "DNA_scene_types.h"
-#include "DNA_object_types.h"
+#include "DNA_object_types.h"
+#include "DNA_lamp_types.h"
 #include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
+#include "DNA_meshdata_types.h"
+#include "BKE_DerivedMesh.h"
+
+/****************************************************************************/
+/********************************   Types   *********************************/
+/****************************************************************************/
+
+/* -----------------------  render api defined  --------------------------- */
+
+typedef struct RenderAPIScene *RNDScene;
+typedef struct RenderAPIObject *RNDObject;
+typedef struct RenderAPILight *RNDLight;
+typedef struct RednerAPIGeometry *RNDGeometry;
+
+typedef struct RenderAPIResult *RNDResult;
+
+/* --------------------------  user defined  ------------------------------ */
+
+typedef struct TemporaryData TemporaryData;
+
+/****************************************************************************/
+/*******************************   Methods   ********************************/
+/****************************************************************************/
+
+void RenderAPI_test();
+
+/* ------------------------------------------------------------------------ */
+/* ----------------------------  context  --------------------------------- */
+/* ------------------------------------------------------------------------ */
+
+/** Get or set the current frame. This is for motion blur calculations. */
+
+float RND_get_current_frame( RNDScene scene );
+void RND_set_current_frame( RNDScene scene, float new_frame );
+
+/** Offsets the current frame by offset. */
+
+void RND_set_frame_offset( RNDScene scene, float offset );
+
+/** 
+    Functions for dealing with the render layers. Render layers
+    are referred to by indices, so getting and setting is done
+    with ints.
+*/
+
+int RND_get_render_layer_count( RNDScene scene );
+int RND_get_render_layer( RNDScene scene );
+void RND_set_render_layer( RNDScene scene, int new_layer );
+
+/* ------------------------------------------------------------------------ */
+/* ----------------------------  settings  -------------------------------- */
+/* ------------------------------------------------------------------------ */
+
+typedef enum RND_SAMPLE_TYPE{
+RND_SAMPLE_MITCH,
+RND_SAMPLE_CATROM,
+RND_SAMPLE_GAUSS,
+RND_SAMPLE_CUBIC,
+RND_SAMPLE_QUAD,
+RND_SAMPLE_TENT,
+RND_SAMPLE_BOX
+} RND_SAMPLE_TYPE;
+
+int RND_is_animation( RNDScene scene );
+int RND_has_motion_blur( RNDScene scene );
+
+int RND_get_image_width( RNDScene scene );
+int RND_get_image_height( RNDScene scene );
+char *RND_get_file_type( RNDScene scene );
+char *RND_get_file_name( RNDScene scene );
+RND_SAMPLE_TYPE RND_get_antialias_type( RNDScene scene );
+int RND_get_antialias_sample_number( RNDScene scene );
+float RND_get_motion_blur_factor( RNDScene scene );
+
+/* ------------------------------------------------------------------------ */
+/* ----------------------------  camera  ---------------------------------- */
+/* ------------------------------------------------------------------------ */
+
+/** Returns true if perspective, false if orthagonal. */
+int RND_is_perspective( RNDScene scene );
+
+float RND_get_lens( RNDScene scene );
+float RND_get_scale( RNDScene scene );
+float RND_get_clipping_start( RNDScene scene );
+float RND_get_clipping_end( RNDScene scene );
+float RND_get_depth_of_field( RNDScene scene );
+
+/* ------------------------------------------------------------------------ */
+/* ----------------------------  object  ---------------------------------- */
+/* ------------------------------------------------------------------------ */
+
+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 = 
+	( RND_LIGHT_POINT | 
+	RND_LIGHT_SPOT | 
+	RND_LIGHT_SUN | 
+	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 = 
+	( RND_GEOMETRY_POLYGON_MESH | 
+	RND_GEOMETRY_SUBDIVISION_SURFACE |
+	RND_GEOMETRY_NURB_SURFACE | 
+	RND_GEOMETRY_METABALL | 
+	RND_GEOMETRY_CURVE | 
+	RND_GEOMETRY_PARTICLE_SYSTEM ),
+
+RND_ALL =
+	( RND_LIGHT |
+	RND_GEOMETRY )
+
+} RND_DATATYPE;
+
+/** 
+    Gets an index of all objects
+    type is a bitwise-or composition of zero or more of the above 
+*/
+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 );
+
+void RND_object_get_name( RNDObject object, char* name );
+RND_DATATYPE RND_object_get_type( RNDObject object );
+void RND_object_get_transformation( RNDObject object, 
+	float transformation[][4] );
+
+/** 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list