Revision: 44866
http://brlcad.svn.sourceforge.net/brlcad/?rev=44866&view=rev
Author: kunigami
Date: 2011-06-09 12:13:09 +0000 (Thu, 09 Jun 2011)
Log Message:
-----------
missing files for osl-renderer to compile
Added Paths:
-----------
brlcad/trunk/src/liboptical/render_svc.cpp
brlcad/trunk/src/liboptical/render_svc.h
Added: brlcad/trunk/src/liboptical/render_svc.cpp
===================================================================
--- brlcad/trunk/src/liboptical/render_svc.cpp (rev 0)
+++ brlcad/trunk/src/liboptical/render_svc.cpp 2011-06-09 12:13:09 UTC (rev
44866)
@@ -0,0 +1,90 @@
+#include "render_svc.h"
+
+#include "render_svc.h"
+using namespace OSL;
+
+#ifdef OSL_NAMESPACE
+namespace OSL_NAMESPACE {
+#endif
+
+namespace OSL {
+
+
+bool
+SimpleRenderer::get_matrix (Matrix44 &result, TransformationPtr xform,
+ float time)
+{
+ // SimpleRenderer doesn't understand motion blur and transformations
+ // are just simple 4x4 matrices.
+ result = *(OSL::Matrix44 *)xform;
+ return true;
+}
+
+
+
+bool
+SimpleRenderer::get_matrix (Matrix44 &result, ustring from, float time)
+{
+ TransformMap::const_iterator found = m_named_xforms.find (from);
+ if (found != m_named_xforms.end()) {
+ result = *(found->second);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+
+void
+SimpleRenderer::name_transform (const char *name, const OSL::Matrix44 &xform)
+{
+ shared_ptr<Transformation> M (new OSL::Matrix44 (xform));
+ m_named_xforms[ustring(name)] = M;
+}
+
+bool
+SimpleRenderer::get_array_attribute (void *renderstate, bool derivatives,
ustring object,
+ TypeDesc type, ustring name,
+ int index, void *val)
+{
+ return false;
+}
+
+bool
+SimpleRenderer::get_attribute (void *renderstate, bool derivatives, ustring
object,
+ TypeDesc type, ustring name, void *val)
+{
+ return false;
+}
+
+bool
+SimpleRenderer::get_userdata (bool derivatives, ustring name, TypeDesc type,
void *renderstate, void *val)
+{
+ return false;
+}
+
+bool
+SimpleRenderer::has_userdata (ustring name, TypeDesc type, void *renderstate)
+{
+ return false;
+}
+
+void *
+SimpleRenderer::get_pointcloud_attr_query (ustring *attr_names,
+ TypeDesc *attr_types, int nattrs)
+{
+ return NULL;
+}
+
+int
+SimpleRenderer::pointcloud (ustring filename, const OSL::Vec3 ¢er, float
radius,
+ int max_points, void *_attr_query, void
**attr_outdata)
+{
+ return 0;
+}
+
+}; // namespace OSL
+
+#ifdef OSL_NAMESPACE
+}; // end namespace OSL_NAMESPACE
+#endif
Property changes on: brlcad/trunk/src/liboptical/render_svc.cpp
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: brlcad/trunk/src/liboptical/render_svc.h
===================================================================
--- brlcad/trunk/src/liboptical/render_svc.h (rev 0)
+++ brlcad/trunk/src/liboptical/render_svc.h 2011-06-09 12:13:09 UTC (rev
44866)
@@ -0,0 +1,90 @@
+#ifndef RENDER_SVC_H
+#define RENDER_SVC_H
+
+#include <map>
+
+#include "oslexec.h"
+
+#ifdef OSL_NAMESPACE
+namespace OSL_NAMESPACE {
+#endif
+
+namespace OSL {
+
+using namespace OSL;
+
+
+
+
+class SimpleRenderer : public RendererServices
+{
+public:
+ // Just use 4x4 matrix for transformations
+ typedef Matrix44 Transformation;
+
+ SimpleRenderer () { }
+ ~SimpleRenderer () { }
+
+ virtual bool get_matrix (Matrix44 &result, TransformationPtr xform,
+ float time);
+ virtual bool get_matrix (Matrix44 &result, ustring from, float time);
+
+ void name_transform (const char *name, const Transformation &xform);
+
+ virtual bool get_array_attribute (void *renderstate, bool derivatives,
+ ustring object, TypeDesc type, ustring
name,
+ int index, void *val );
+ virtual bool get_attribute (void *renderstate, bool derivatives, ustring
object,
+ TypeDesc type, ustring name, void *val);
+ virtual bool get_userdata (bool derivatives, ustring name, TypeDesc type,
+ void *renderstate, void *val);
+ virtual bool has_userdata (ustring name, TypeDesc type, void *renderstate);
+ virtual void *get_pointcloud_attr_query (ustring *attr_names,
+ TypeDesc *attr_types, int nattrs);
+ virtual int pointcloud (ustring filename, const OSL::Vec3 ¢er, float
radius,
+ int max_points, void *attr_query, void
**attr_outdata);
+
+private:
+ typedef std::map <ustring, shared_ptr<Transformation> > TransformMap;
+ TransformMap m_named_xforms;
+
+#if 0
+ // Example cached data for pointcloud implementation with Partio
+
+ // OSL gets pointers to this but its definition is private.
+ // Right now it only caches the types already converted to
+ // Partio constants. This is what get_pointcloud_attr_query
+ // returns
+ struct AttrQuery
+ {
+ // Names of the attributes to query
+ std::vector<ustring> attr_names;
+ // Types as (enum Partio::ParticleAttributeType) of the
+ // attributes in the query
+ std::vector<int> attr_partio_types;
+ // For sanity checks, capacity of the output arrays
+ int capacity;
+ };
+
+ // We will left this function as an exercise. It is only responsible
+ // for loading the point cloud if it is not already in memory and so
+ // on. You might or might not use Partio cache system
+ Partio::ParticleData *get_pointcloud (ustring filename);
+
+ // Keep a list so adding elements doesn't invalidate pointers.
+ // Careful, don't use a vector here!
+ std::list<AttrQuery> m_attr_queries;
+#endif
+};
+
+
+
+}; // namespace OSL
+
+#ifdef OSL_NAMESPACE
+}; // end namespace OSL_NAMESPACE
+using namespace OSL_NAMESPACE;
+#endif
+
+
+#endif /* RENDER_SVC_H */
Property changes on: brlcad/trunk/src/liboptical/render_svc.h
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits