Commit 2fed89ad86761b950077b815fbd0a85a21f649e2
1 parent
c015449b
(Mesh Visual) Changed the stage colour
Change-Id: Ia0c00bd55018abeae0d478f33aa33d01bf7dfbdf
Showing
1 changed file
with
58 additions
and
56 deletions
examples/mesh-visual/mesh-visual-example.cpp
| ... | ... | @@ -6,65 +6,67 @@ using namespace Dali::Toolkit; |
| 6 | 6 | |
| 7 | 7 | namespace |
| 8 | 8 | { |
| 9 | - //Keeps information about each model for access. | |
| 10 | - struct Model | |
| 11 | - { | |
| 12 | - Control control; // Control housing the mesh visual of the model. | |
| 13 | - Vector2 rotation; // Keeps track of rotation about x and y axis for manual rotation. | |
| 14 | - Animation rotationAnimation; // Automatically rotates when left alone. | |
| 15 | - }; | |
| 9 | +// Keeps information about each model for access. | |
| 10 | +struct Model | |
| 11 | +{ | |
| 12 | + Control control; // Control housing the mesh visual of the model. | |
| 13 | + Vector2 rotation; // Keeps track of rotation about x and y axis for manual rotation. | |
| 14 | + Animation rotationAnimation; // Automatically rotates when left alone. | |
| 15 | +}; | |
| 16 | 16 | |
| 17 | - //Files for meshes | |
| 18 | - const char * const MODEL_FILE_TABLE[] = | |
| 19 | - { | |
| 20 | - DEMO_MODEL_DIR "Dino.obj", | |
| 21 | - DEMO_MODEL_DIR "ToyRobot-Metal.obj", | |
| 22 | - DEMO_MODEL_DIR "Toyrobot-Plastic.obj" | |
| 23 | - }; | |
| 17 | +// Files for meshes | |
| 18 | +const char * const MODEL_FILE_TABLE[] = | |
| 19 | +{ | |
| 20 | + DEMO_MODEL_DIR "Dino.obj", | |
| 21 | + DEMO_MODEL_DIR "ToyRobot-Metal.obj", | |
| 22 | + DEMO_MODEL_DIR "Toyrobot-Plastic.obj" | |
| 23 | +}; | |
| 24 | 24 | |
| 25 | - const char * const MATERIAL_FILE_TABLE[] = | |
| 26 | - { | |
| 27 | - DEMO_MODEL_DIR "Dino.mtl", | |
| 28 | - DEMO_MODEL_DIR "ToyRobot-Metal.mtl", | |
| 29 | - DEMO_MODEL_DIR "Toyrobot-Plastic.mtl" | |
| 30 | - }; | |
| 25 | +const char * const MATERIAL_FILE_TABLE[] = | |
| 26 | +{ | |
| 27 | + DEMO_MODEL_DIR "Dino.mtl", | |
| 28 | + DEMO_MODEL_DIR "ToyRobot-Metal.mtl", | |
| 29 | + DEMO_MODEL_DIR "Toyrobot-Plastic.mtl" | |
| 30 | +}; | |
| 31 | 31 | |
| 32 | - const char * const TEXTURES_PATH( DEMO_IMAGE_DIR "" ); | |
| 32 | +const char * const TEXTURES_PATH( DEMO_IMAGE_DIR "" ); | |
| 33 | 33 | |
| 34 | - //Possible shading modes. | |
| 35 | - MeshVisual::ShadingMode::Value SHADING_MODE_TABLE[] = | |
| 36 | - { | |
| 37 | - MeshVisual::ShadingMode::TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING, | |
| 38 | - MeshVisual::ShadingMode::TEXTURED_WITH_SPECULAR_LIGHTING, | |
| 39 | - MeshVisual::ShadingMode::TEXTURELESS_WITH_DIFFUSE_LIGHTING | |
| 40 | - }; | |
| 41 | - | |
| 42 | - //Button labels. | |
| 43 | - const char * const PAUSE = " || "; | |
| 44 | - const char * const PLAY = " > "; | |
| 45 | - const char * const FIXED = "FIXED"; | |
| 46 | - const char * const MANUAL = "MANUAL"; | |
| 47 | - const char * const FRONT = "FRONT"; | |
| 48 | - const char * const BACK = "BACK"; | |
| 49 | - | |
| 50 | - //Image urls for the light. | |
| 51 | - const char * const LIGHT_URL_FRONT = DEMO_IMAGE_DIR "light-icon-front.png"; | |
| 52 | - const char * const LIGHT_URL_BACK = DEMO_IMAGE_DIR "light-icon-back.png"; | |
| 53 | - | |
| 54 | - const float X_ROTATION_DISPLACEMENT_FACTOR = 60.0f; | |
| 55 | - const float Y_ROTATION_DISPLACEMENT_FACTOR = 60.0f; | |
| 56 | - const float MODEL_SCALE = 0.75f; | |
| 57 | - const float LIGHT_SCALE = 0.15f; | |
| 58 | - const float BUTTONS_OFFSET_BOTTOM = 0.08f; | |
| 59 | - const float BUTTONS_OFFSET_SIDE = 0.2f; | |
| 60 | - const int NUM_MESHES = 2; | |
| 61 | - | |
| 62 | - //Used to identify actors. | |
| 63 | - const int MODEL_TAG = 0; | |
| 64 | - const int LIGHT_TAG = 1; | |
| 65 | - const int LAYER_TAG = 2; | |
| 66 | - | |
| 67 | -} //End namespace | |
| 34 | +// Possible shading modes. | |
| 35 | +MeshVisual::ShadingMode::Value SHADING_MODE_TABLE[] = | |
| 36 | +{ | |
| 37 | + MeshVisual::ShadingMode::TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING, | |
| 38 | + MeshVisual::ShadingMode::TEXTURED_WITH_SPECULAR_LIGHTING, | |
| 39 | + MeshVisual::ShadingMode::TEXTURELESS_WITH_DIFFUSE_LIGHTING | |
| 40 | +}; | |
| 41 | + | |
| 42 | +// Button labels. | |
| 43 | +const char * const PAUSE = " || "; | |
| 44 | +const char * const PLAY = " > "; | |
| 45 | +const char * const FIXED = "FIXED"; | |
| 46 | +const char * const MANUAL = "MANUAL"; | |
| 47 | +const char * const FRONT = "FRONT"; | |
| 48 | +const char * const BACK = "BACK"; | |
| 49 | + | |
| 50 | +// Image urls for the light. | |
| 51 | +const char * const LIGHT_URL_FRONT = DEMO_IMAGE_DIR "light-icon-front.png"; | |
| 52 | +const char * const LIGHT_URL_BACK = DEMO_IMAGE_DIR "light-icon-back.png"; | |
| 53 | + | |
| 54 | +const float X_ROTATION_DISPLACEMENT_FACTOR = 60.0f; | |
| 55 | +const float Y_ROTATION_DISPLACEMENT_FACTOR = 60.0f; | |
| 56 | +const float MODEL_SCALE = 0.75f; | |
| 57 | +const float LIGHT_SCALE = 0.15f; | |
| 58 | +const float BUTTONS_OFFSET_BOTTOM = 0.08f; | |
| 59 | +const float BUTTONS_OFFSET_SIDE = 0.2f; | |
| 60 | +const int NUM_MESHES = 2; | |
| 61 | + | |
| 62 | +// Used to identify actors. | |
| 63 | +const int MODEL_TAG = 0; | |
| 64 | +const int LIGHT_TAG = 1; | |
| 65 | +const int LAYER_TAG = 2; | |
| 66 | + | |
| 67 | +const Vector4 STAGE_COLOR( 211.0f / 255.0f, 211.0f / 255.0f, 211.0f / 255.0f, 1.0f ); ///< The color of the stage | |
| 68 | + | |
| 69 | +} // unnamed namespace | |
| 68 | 70 | |
| 69 | 71 | class MeshVisualController : public ConnectionTracker |
| 70 | 72 | { |
| ... | ... | @@ -93,7 +95,7 @@ public: |
| 93 | 95 | { |
| 94 | 96 | // Get a handle to the stage |
| 95 | 97 | Stage stage = Stage::GetCurrent(); |
| 96 | - stage.SetBackgroundColor( Vector4( 0.0, 0.5, 1.0, 1.0 ) ); | |
| 98 | + stage.SetBackgroundColor( STAGE_COLOR ); | |
| 97 | 99 | |
| 98 | 100 | //Set up root layer to receive touch gestures. |
| 99 | 101 | Layer rootLayer = stage.GetRootLayer(); | ... | ... |