1 // ============================================================================= 2 // PROJECT CHRONO - http://projectchrono.org 3 // 4 // Copyright (c) 2014 projectchrono.org 5 // All rights reserved. 6 // 7 // Use of this source code is governed by a BSD-style license that can be found 8 // in the LICENSE file at the top level of the distribution and at 9 // http://projectchrono.org/license-chrono.txt. 10 // 11 // ============================================================================= 12 // Authors: Hammad Mazhar 13 // ============================================================================= 14 // This class supports ADS lighting with glow and texture coordinates 15 // Nothing too interesting here, note that the order for the members is important 16 // Based on code provided by Perry Kivolowitz. 17 // P = position 18 // C = color 19 // N = normal 20 // T = texture coordinates 21 22 // A = Ambient 23 // D = Diffuse 24 // S = Specular 25 // ============================================================================= 26 27 #ifndef CHOPENGLVERTEXATTRIBUTE_H 28 #define CHOPENGLVERTEXATTRIBUTE_H 29 30 #include "chrono_opengl/core/ChApiOpenGL.h" 31 #include <glm/glm.hpp> 32 33 namespace chrono { 34 namespace opengl { 35 36 /// @addtogroup opengl_module 37 /// @{ 38 39 /// Support for ADS lighting with glow and texture coordinates. 40 class CH_OPENGL_API ChOpenGLVertexAttributesPADSNT { 41 public: 42 ChOpenGLVertexAttributesPADSNT(); 43 ChOpenGLVertexAttributesPADSNT(const glm::vec3& p, 44 const glm::vec3& c_a, 45 const glm::vec3& c_d, 46 const glm::vec3& c_s, 47 const glm::vec3& n, 48 const glm::vec2& t); 49 ChOpenGLVertexAttributesPADSNT(const ChOpenGLVertexAttributesPADSNT& other); 50 glm::vec3 position; 51 glm::vec3 normal; 52 glm::vec3 color_ambient; 53 glm::vec3 color_diffuse; 54 glm::vec3 color_specular; 55 glm::vec2 texture_coordinate; 56 }; 57 58 /// Support for ADS lighting with glow. 59 class CH_OPENGL_API ChOpenGLVertexAttributesPADSN { 60 public: 61 ChOpenGLVertexAttributesPADSN(); 62 ChOpenGLVertexAttributesPADSN(const glm::vec3& p, 63 const glm::vec3& c_a, 64 const glm::vec3& c_d, 65 const glm::vec3& c_s, 66 const glm::vec3& n); 67 ChOpenGLVertexAttributesPADSN(const ChOpenGLVertexAttributesPADSN& other); 68 glm::vec3 position; 69 glm::vec3 normal; 70 glm::vec3 color_ambient; 71 glm::vec3 color_diffuse; 72 glm::vec3 color_specular; 73 }; 74 75 class CH_OPENGL_API ChOpenGLVertexAttributesPCNT { 76 public: 77 ChOpenGLVertexAttributesPCNT(); 78 ChOpenGLVertexAttributesPCNT(const glm::vec3& p, const glm::vec3& c, const glm::vec3& n, const glm::vec2& t); 79 ChOpenGLVertexAttributesPCNT(const ChOpenGLVertexAttributesPCNT& other); 80 glm::vec3 position; 81 glm::vec3 normal; 82 glm::vec3 color; 83 glm::vec2 texture_coordinate; 84 }; 85 86 class CH_OPENGL_API ChOpenGLVertexAttributesPCN { 87 public: 88 ChOpenGLVertexAttributesPCN(); 89 ChOpenGLVertexAttributesPCN(const glm::vec3& p, const glm::vec3& c, const glm::vec3& n); 90 ChOpenGLVertexAttributesPCN(const ChOpenGLVertexAttributesPCN& other); 91 glm::vec3 position; 92 glm::vec3 normal; 93 glm::vec3 color; 94 }; 95 96 class CH_OPENGL_API ChOpenGLVertexAttributesPN { 97 public: 98 ChOpenGLVertexAttributesPN(); 99 ChOpenGLVertexAttributesPN(const glm::vec3& p, const glm::vec3& n); 100 ChOpenGLVertexAttributesPN(const ChOpenGLVertexAttributesPN& other); 101 glm::vec3 position; 102 glm::vec3 normal; 103 }; 104 105 class CH_OPENGL_API ChOpenGLVertexAttributesP { 106 public: 107 ChOpenGLVertexAttributesP(); 108 ChOpenGLVertexAttributesP(const glm::vec3& p); 109 ChOpenGLVertexAttributesP(const ChOpenGLVertexAttributesP& other); 110 glm::vec3 position; 111 }; 112 113 /// @} opengl_module 114 115 } 116 } 117 118 #endif 119