DI-Guy SDK Documentation  13.2
diguyOsgGraphicsShape.h
Go to the documentation of this file.
1 #pragma once
2 
3 
4 #include <diguyGraphicsShape.h>
5 
6 #include <osg/Switch>
7 #include <osg/LOD>
8 #include <osg/Geode>
9 #include <osg/Texture2D>
10 
11 
24 {
25 
26 public:
27 
28  diguyOsgGraphicsShape(void* internal_data);
29 
30  virtual void build();
31 
32  virtual void unbuild();
33  virtual void show();
34  virtual void hide();
35 
36  virtual void instancing_state_changed(int val);
37 
38  virtual void set_graphics_lod_ranges(float* lod_ranges);
39  virtual void set_graphics_lod(int lod);
40 
41 
42  static void set_use_pixel_lods(bool use_pixel_lods) {s_use_pixel_lods = use_pixel_lods;}
43 
44  /*
45  * Overrides the base class and gives an opportunity to feed per shape
46  * matrix data to shader.
47  */
48  virtual void update();
49  virtual void update_variation_texture(int num_pixels, unsigned char * pixel_data);
50 
51  /*
52  * String to use for the uniform array of bones.
53  */
54  static char* s_ufrm_link_matrices_string;
55  static char* s_ufrm_link_colors_string;
56 
57  std::vector<osg::Geode*> m_geodes;
58 
59 protected:
60  void create_shared_variation_texture();
61  void create_variation_texture(unsigned char * variation_texture_data);
62 
63  osg::ref_ptr<osg::Switch> m_switch_node;
64 
65  /*
66  * One and only one of m_lod_node and m_manual_lod_switch_node
67  * should be non-NULL.
68  */
69  osg::ref_ptr<osg::LOD> m_lod_node;
70 
71  static bool s_use_pixel_lods;
72  osg::ref_ptr<osg::StateSet> m_state_set;
73  osg::ref_ptr<osg::Uniform> m_ufrm_link_matrices;
74  osg::ref_ptr<osg::Uniform> m_ufrm_link_colors;
75  osg::ref_ptr<osg::Uniform> m_ufrm_component_map_row;
76 
77 public:
78  static osg::ref_ptr<osg::Texture2D> sm_variation_texture;
79 };
80 
81 
88 
89 
virtual void unbuild()
This function will be called by DI-Guy when it is time for the renderer-specific shape objects create...
Definition: diguyOsgGraphicsShape.cpp:471
static char * s_ufrm_link_colors_string
Definition: diguyOsgGraphicsShape.h:52
virtual void show()
This function will be called by DI-Guy when the shape should be shown, typically due to a change in t...
Definition: diguyOsgGraphicsShape.cpp:537
diguyOsgGraphicsShape(void *internal_data)
Definition: diguyOsgGraphicsShape.cpp:52
diguyGraphicsShape * diguyOsgGraphicsShape_create_func(void *internal_data)
Create function declaration.
Definition: diguyOsgGraphicsShape.cpp:745
virtual void build()
This function will be called by DI-Guy when it is time for renderer-specific shape objects to be crea...
Definition: diguyOsgGraphicsShape.cpp:223
static void set_use_pixel_lods(bool use_pixel_lods)
Definition: diguyOsgGraphicsShape.h:39
virtual void hide()
This function will be called by DI-Guy when the shape should be hidden, typically due to a change in ...
Definition: diguyOsgGraphicsShape.cpp:561
virtual void update_variation_texture(int num_pixels, unsigned char *pixel_data)
Pushes a char * pixel buffer of length num_pixels that represents the unique per shape texture...
Definition: diguyOsgGraphicsShape.cpp:730
Shapes are the high-level containers of visible geometry.
Definition: diguyOsgGraphicsShape.h:21
virtual void set_graphics_lod(int lod)
This function will be called by DI-Guy when the LOD of this link is "manually" set by a diguyCharacte...
Definition: diguyOsgGraphicsShape.cpp:723
static char * s_ufrm_link_matrices_string
Definition: diguyOsgGraphicsShape.h:51
virtual void update()
This function will be called by DI-Guy when it is time for renderer-specific shape objects created du...
Definition: diguyOsgGraphicsShape.cpp:591
A class that represents the unique per-character non-shared mesh object. DI-Guy encapsulates its text...
Definition: diguyGraphicsShape.h:51
virtual void set_graphics_lod_ranges(float *lod_ranges)
This function will be called by DI-Guy when the LOD ranges of this shape need to be updated after the...
Definition: diguyOsgGraphicsShape.cpp:693
virtual void instancing_state_changed(int val)
Definition: diguyOsgGraphicsShape.cpp:573