BRL-CAD
render_svc.h
Go to the documentation of this file.
1 /* R E N D E R _ S V C . H
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 #ifndef LIBOPTICAL_RENDER_SVC_H
22 #define LIBOPTICAL_RENDER_SVC_H
23 
24 #include "common.h"
25 
26 #include <map>
27 
28 #include "oslexec.h"
29 
30 #ifdef OSL_NAMESPACE
31 namespace OSL_NAMESPACE {
32 #endif
33 
34 namespace OSL {
35 
36 using namespace OSL;
37 
38 
39 class SimpleRenderer : public RendererServices
40 {
41 public:
42  // Just use 4x4 matrix for transformations
43  typedef Matrix44 Transformation;
44 
47 
48  virtual bool get_matrix (Matrix44 &result, TransformationPtr xform,
49  float time);
50  virtual bool get_matrix (Matrix44 &result, ustring from, float time);
51 
52  virtual bool get_matrix (Matrix44 &result, TransformationPtr xform);
53  virtual bool get_matrix (Matrix44 &result, ustring from);
54 
55  void name_transform (const char *name, const Transformation &xform);
56 
57  virtual bool get_array_attribute (void *renderstate, bool derivatives,
58  ustring object, TypeDesc type, ustring name,
59  int index, void *val );
60  virtual bool get_attribute (void *renderstate, bool derivatives, ustring object,
61  TypeDesc type, ustring name, void *val);
62  virtual bool get_userdata (bool derivatives, ustring name, TypeDesc type,
63  void *renderstate, void *val);
64  virtual bool has_userdata (ustring name, TypeDesc type, void *renderstate);
65  virtual void *get_pointcloud_attr_query (ustring *attr_names,
66  TypeDesc *attr_types, int nattrs);
67  virtual int pointcloud (ustring filename, const OSL::Vec3 &center, float radius,
68  int max_points, void *attr_query, void **attr_outdata);
69 
70  virtual int pointcloud_search (ustring filename, const OSL::Vec3 &center,
71  float radius, int max_points, size_t *out_indices,
72  float *out_distances, int derivs_offset);
73 
74  virtual int pointcloud_get (ustring filename, size_t *indices, int count,
75  ustring attr_name, TypeDesc attr_type,
76  void *out_data);
77 private:
78  typedef std::map <ustring, shared_ptr<Transformation> > TransformMap;
79  TransformMap m_named_xforms;
80 };
81 
82 
83 }; // namespace OSL
84 
85 #ifdef OSL_NAMESPACE
86 }; // end namespace OSL_NAMESPACE
87 using namespace OSL_NAMESPACE;
88 #endif
89 
90 
91 #endif /* LIBOPTICAL_RENDER_SVC_H */
92 
93 /*
94  * Local Variables:
95  * tab-width: 8
96  * mode: C
97  * indent-tabs-mode: t
98  * c-file-style: "stroustrup"
99  * End:
100  * ex: shiftwidth=4 tabstop=8
101  */
Definition: db_flip.c:35
char filename[MAXLENGTH]
Definition: human.c:105
Matrix44 Transformation
Definition: render_svc.h:43
Definition: clone.c:90
Header file for the BRL-CAD common definitions.
long time(time_t *)