[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11227] branches/soc-2007-mosani/source/ blender/render/render_api: I added basic geometry export.
Aaron Moore
two.a.ron at gmail.com
Wed Jul 11 12:29:18 CEST 2007
Revision: 11227
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11227
Author: mosani
Date: 2007-07-11 12:29:18 +0200 (Wed, 11 Jul 2007)
Log Message:
-----------
I added basic geometry export. All of the functions in the
polygon mesh section of the specification are working now.
A test is in place: it prints the geometry of any meshes
to the console.
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/source/RND_helpers.c
branches/soc-2007-mosani/source/blender/render/render_api/source/test.c
Added Paths:
-----------
branches/soc-2007-mosani/source/blender/render/render_api/source/RND_geometry.c
branches/soc-2007-mosani/source/blender/render/render_api/source/RND_mesh.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-11 10:13:59 UTC (rev 11226)
+++ branches/soc-2007-mosani/source/blender/render/render_api/include/RND_types.h 2007-07-11 10:29:18 UTC (rev 11227)
@@ -108,8 +108,40 @@
DerivedMesh *meshSource;
Curve *curveSource;
MetaBall *metaballSource;
+
+ /* handlers generated */
+ struct RenderAPIVertex* vertices;
+ struct RenderAPIEdge* edges;
+ struct RenderAPIFace* faces;
}RenderAPIGeometry;
+typedef struct RenderAPIVertex{
+ struct RenderAPIVertex *next, *prev;
+ int count, current;
+ struct MVert *source;
+}RenderAPIVertex;
+
+typedef struct RenderAPIEdge{
+ struct RenderAPIEdge *next, *prev;
+ int count, current;
+ struct MEdge *source;
+}RenderAPIEdge;
+
+typedef struct RenderAPIFace{
+ struct RenderAPIFace *next, *prev;
+ int count, current;
+ struct MFace *source;
+
+ /* index generated */
+ ListBase indices;
+}RenderAPIFace;
+
+typedef struct RenderAPIIndex{
+ struct RenderAPIIndex *next, *prev;
+ int count, current;
+ int list[4];
+}RenderAPIIndex;
+
typedef struct RenderAPIResult{
}RenderAPIResult;
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-11 10:13:59 UTC (rev 11226)
+++ branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI.h 2007-07-11 10:29:18 UTC (rev 11227)
@@ -76,7 +76,11 @@
typedef struct RenderAPIScene *RNDScene;
typedef struct RenderAPIObject *RNDObject;
typedef struct RenderAPILight *RNDLight;
-typedef struct RednerAPIGeometry *RNDGeometry;
+typedef struct RenderAPIGeometry *RNDGeometry;
+typedef struct RenderAPIVertex *RNDVertex;
+typedef struct RenderAPIEdge *RNDEdge;
+typedef struct RenderAPIFace *RNDFace;
+typedef struct RenderAPIIndex *RNDIndex;
typedef struct RenderAPIResult *RNDResult;
@@ -241,10 +245,70 @@
/* ---------------------------- geometry -------------------------------- */
/* ------------------------------------------------------------------------ */
+RNDGeometry RND_object_get_geometry( RNDObject object );
+RND_DATATYPE RND_geometry_get_type( RNDGeometry geometry );
+/* Converts geometry to polygon mesh type. If geometry is
+ * a polygon mesh, does nothing. */
+void RND_geometry_to_polygon_mesh( RNDGeometry geometry );
+/* Returns true if surface interpolation is smooth,
+ * and false if surface interpolation is solid. */
+int RND_geometry_is_smooth_interpolation( RNDGeometry geometry );
+
+/* Returns true if the geometry deforms in this frame. */
+int RND_geometry_deforms( RNDGeometry geometry );
+
+/* Standard functions */
+
+TemporaryData *RND_geometry_get_temporary_data( RNDGeometry geometry );
+void RND_geometry_set_temporary_data( RNDGeometry geometry,
+ TemporaryData *temp );
+
/* ------------------------------------------------------------------------ */
+/* ----------------------------- meshes --------------------------------- */
/* ------------------------------------------------------------------------ */
+
+RNDVertex RND_geometry_get_vertices( RNDGeometry geometry );
+RNDEdge RND_geometry_get_edges( RNDGeometry geometry );
+RNDFace RND_geometry_get_faces( RNDGeometry geometry );
+
+int RND_vertex_get_count( RNDVertex vertices );
+int RND_edge_get_count( RNDEdge edges );
+int RND_face_get_count( RNDFace faces );
+int RND_face_get_index_count( RNDFace face );
+
+/* The coordinates parameter is an array of 3. */
+void RND_vertex_get_coordinates( RNDVertex vertex, float coordinates[] );
+
+/* The indices parameter is an array of 2. */
+void RND_edge_get_indices( RNDEdge edge, int indices[] );
+
+/* The RNDIndex type is to allow face indices to be of
+ * arbitrary length to allow the eventual incorporation of n-gons. */
+
+RNDIndex RND_face_get_indices( RNDFace face );
+int RND_index_get_value( RNDIndex index );
+
+/* Standard Functions */
+
+int RND_vertex_exists( RNDVertex vertex );
+int RND_edge_exists( RNDEdge edge );
+int RND_face_exists( RNDFace face );
+int RND_index_exists( RNDIndex index );
+
+void RND_vertex_first( RNDVertex vertex );
+void RND_edge_first( RNDEdge edge );
+void RND_face_first( RNDFace face );
+void RND_index_first( RNDIndex index );
+
+void RND_vertex_next( RNDVertex );
+void RND_edge_next( RNDEdge );
+void RND_face_next( RNDFace face );
+void RND_index_next( RNDIndex index );
+
+
+/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
#endif
Added: branches/soc-2007-mosani/source/blender/render/render_api/source/RND_geometry.c
===================================================================
--- branches/soc-2007-mosani/source/blender/render/render_api/source/RND_geometry.c (rev 0)
+++ branches/soc-2007-mosani/source/blender/render/render_api/source/RND_geometry.c 2007-07-11 10:29:18 UTC (rev 11227)
@@ -0,0 +1,69 @@
+/**
+ * RND_geometry.c, 2 July 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: Aaron Moore (mosani)
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "RenderAPI.h"
+#include "RND_types.h"
+#include "RenderAPI_helpers.h"
+
+/**
+ * Geometry settings.
+ */
+
+RNDGeometry RND_object_get_geometry( RNDObject object )
+{
+ struct RenderAPIGeometry *geometry = NULL;
+
+ /* if object is not a light, return null */
+ if( !(object->current->holder->type & RND_GEOMETRY) ) return geometry;
+
+ geometry = MEM_mallocN( sizeof(RenderAPIGeometry),
+ "renderAPI geometry" );
+ geometry->type = object->current->holder->type;
+ if( geometry->type & RND_GEOMETRY_POLYGON_MESH ){
+ geometry->meshSource =
+ mesh_create_derived_render( object->current->holder->source, 0 );
+ }
+
+ geometry->vertices = NULL;
+ geometry->edges = NULL;
+ geometry->faces = NULL;
+ BLI_addtail( &object->geometry, geometry );
+ return geometry;
+}
+
+RND_DATATYPE RND_geometry_get_type( RNDGeometry geometry ){}
+
+void RND_geometry_to_polygon_mesh( RNDGeometry geometry ){}
+
+int RND_geometry_is_smooth_interpolation( RNDGeometry geometry ){}
+
+int RND_geometry_deforms( RNDGeometry geometry ){}
+
+TemporaryData *RND_geometry_get_temporary_data( RNDGeometry geometry ){}
+
+void RND_geometry_set_temporary_data( RNDGeometry geometry,
+ TemporaryData *temp ){}
+
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-11 10:13:59 UTC (rev 11226)
+++ branches/soc-2007-mosani/source/blender/render/render_api/source/RND_helpers.c 2007-07-11 10:29:18 UTC (rev 11227)
@@ -56,6 +56,8 @@
void RenderAPI_free_scene( RNDScene scene ){
RNDObject object_free;
+ RNDGeometry geometry_free;
+ DerivedMesh *derived_mesh;
BLI_freelistN( &scene->objects );
BLI_freelistN( &scene->light_point );
BLI_freelistN( &scene->light_spot );
@@ -76,6 +78,27 @@
{
BLI_freelistN( &object_free->list );
BLI_freelistN( &object_free->lights );
+
+ geometry_free = object_free->geometry.first;
+ for( ; geometry_free; geometry_free = geometry_free->next )
+ {
+ if( geometry_free->vertices != NULL )
+ MEM_freeN( geometry_free->vertices );
+
+ if( geometry_free->edges != NULL )
+ MEM_freeN( geometry_free->edges );
+
+ if( geometry_free->faces != NULL &&
+ geometry_free->faces->indices.first != NULL )
+ BLI_freelistN( &geometry_free->faces->indices );
+
+ if( geometry_free->faces != NULL )
+ MEM_freeN( geometry_free->faces );
+
+ derived_mesh = geometry_free->meshSource;
+ if( derived_mesh != NULL )
+ derived_mesh->release( derived_mesh );
+ }
BLI_freelistN( &object_free->geometry );
}
BLI_freelistN( &scene->object_handlers );
Added: branches/soc-2007-mosani/source/blender/render/render_api/source/RND_mesh.c
===================================================================
--- branches/soc-2007-mosani/source/blender/render/render_api/source/RND_mesh.c (rev 0)
+++ branches/soc-2007-mosani/source/blender/render/render_api/source/RND_mesh.c 2007-07-11 10:29:18 UTC (rev 11227)
@@ -0,0 +1,203 @@
+/**
+ * RND_mesh.c, 2 July 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: Aaron Moore (mosani)
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "RenderAPI.h"
+#include "RND_types.h"
+#include "RenderAPI_helpers.h"
+
+/**
+ * Polygon Mesh Export Functions.
+ */
+
+
+RNDVertex RND_geometry_get_vertices( RNDGeometry geometry )
+{
+ RenderAPIVertex *vertex = NULL;
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list