BRL-CAD
render_svc.cpp
Go to the documentation of this file.
1 /* R E N D E R _ S V C . C P P
2  * BRL-CAD
3  *
4  * Copyright (c) 2012-2014 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 
21 #include "render_svc.h"
22 
23 using namespace OSL;
24 
25 #ifdef OSL_NAMESPACE
26 namespace OSL_NAMESPACE {
27 #endif
28 
29 namespace OSL {
30 
31 
32 bool
33 SimpleRenderer::get_matrix (Matrix44 &result, TransformationPtr xform,
34  float time)
35 {
36  // SimpleRenderer doesn't understand motion blur and transformations
37  // are just simple 4x4 matrices.
38  result = *(OSL::Matrix44 *)xform;
39  return true;
40 }
41 
42 
43 bool
44 SimpleRenderer::get_matrix (Matrix44 &result, ustring from, float time)
45 {
46  TransformMap::const_iterator found = m_named_xforms.find (from);
47  if (found != m_named_xforms.end()) {
48  result = *(found->second);
49  return true;
50  } else {
51  return false;
52  }
53 }
54 
55 bool
56 SimpleRenderer::get_matrix (Matrix44 &result, TransformationPtr xform)
57 {
58  // SimpleRenderer doesn't understand motion blur and transformations
59  // are just simple 4x4 matrices.
60  result = *(OSL::Matrix44 *)xform;
61  return true;
62 }
63 
64 
65 bool
66 SimpleRenderer::get_matrix (Matrix44 &result, ustring from)
67 {
68  // SimpleRenderer doesn't understand motion blur, so we never fail
69  // on account of time-varying transformations.
70  TransformMap::const_iterator found = m_named_xforms.find (from);
71  if (found != m_named_xforms.end()) {
72  result = *(found->second);
73  return true;
74  } else {
75  return false;
76  }
77 }
78 
79 
80 void
81 SimpleRenderer::name_transform (const char *name, const OSL::Matrix44 &xform)
82 {
83  shared_ptr<Transformation> M (new OSL::Matrix44 (xform));
84  m_named_xforms[ustring(name)] = M;
85 }
86 
87 bool
88 SimpleRenderer::get_array_attribute (void *renderstate, bool derivatives, ustring object,
89  TypeDesc type, ustring name,
90  int index, void *val)
91 {
92  return false;
93 }
94 
95 bool
96 SimpleRenderer::get_attribute (void *renderstate, bool derivatives, ustring object,
97  TypeDesc type, ustring name, void *val)
98 {
99  return false;
100 }
101 
102 bool
103 SimpleRenderer::get_userdata (bool derivatives, ustring name, TypeDesc type, void *renderstate, void *val)
104 {
105  return false;
106 }
107 
108 bool
109 SimpleRenderer::has_userdata (ustring name, TypeDesc type, void *renderstate)
110 {
111  return false;
112 }
113 
114 void *
116  TypeDesc *attr_types, int nattrs)
117 {
118  return NULL;
119 }
120 
121 int
122 SimpleRenderer::pointcloud (ustring filename, const OSL::Vec3 &center, float radius,
123  int max_points, void *_attr_query, void **attr_outdata)
124 {
125  return 0;
126 }
127 
128 int
129 SimpleRenderer::pointcloud_search (ustring filename, const OSL::Vec3 &center,
130  float radius, int max_points, size_t *out_indices,
131  float *out_distances, int derivs_offset)
132 {
133  return 0;
134 }
135 
136 int
137 SimpleRenderer::pointcloud_get (ustring filename, size_t *indices, int count,
138  ustring attr_name, TypeDesc attr_type,
139  void *out_data)
140 {
141  return 0;
142 }
143 
144 }; // namespace OSL
145 
146 #ifdef OSL_NAMESPACE
147 }; // end namespace OSL_NAMESPACE
148 #endif
149 
150 // Local Variables:
151 // tab-width: 8
152 // mode: C++
153 // c-basic-offset: 4
154 // indent-tabs-mode: t
155 // c-file-style: "stroustrup"
156 // End:
157 // ex: shiftwidth=4 tabstop=8
Definition: db_flip.c:35
char filename[MAXLENGTH]
Definition: human.c:105
Definition: clone.c:90
long time(time_t *)
virtual bool get_userdata(bool derivatives, ustring name, TypeDesc type, void *renderstate, void *val)
Definition: render_svc.cpp:103
virtual bool get_attribute(void *renderstate, bool derivatives, ustring object, TypeDesc type, ustring name, void *val)
Definition: render_svc.cpp:96
virtual int pointcloud_get(ustring filename, size_t *indices, int count, ustring attr_name, TypeDesc attr_type, void *out_data)
Definition: render_svc.cpp:137
virtual bool get_array_attribute(void *renderstate, bool derivatives, ustring object, TypeDesc type, ustring name, int index, void *val)
Definition: render_svc.cpp:88
virtual void * get_pointcloud_attr_query(ustring *attr_names, TypeDesc *attr_types, int nattrs)
Definition: render_svc.cpp:115
virtual bool get_matrix(Matrix44 &result, TransformationPtr xform, float time)
Definition: render_svc.cpp:33
void name_transform(const char *name, const Transformation &xform)
Definition: render_svc.cpp:81
virtual bool has_userdata(ustring name, TypeDesc type, void *renderstate)
Definition: render_svc.cpp:109
virtual int pointcloud_search(ustring filename, const OSL::Vec3 &center, float radius, int max_points, size_t *out_indices, float *out_distances, int derivs_offset)
Definition: render_svc.cpp:129
virtual int pointcloud(ustring filename, const OSL::Vec3 &center, float radius, int max_points, void *attr_query, void **attr_outdata)
Definition: render_svc.cpp:122
#define M
Definition: msr.c:52