~om26er/ubuntu/oneiric/nux/sru-888039

« back to all changes in this revision

Viewing changes to NuxGraphics/IOpenGLVertexDeclaration.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2011-07-21 18:41:46 UTC
  • mfrom: (1.1.23 upstream)
  • Revision ID: james.westby@ubuntu.com-20110721184146-po1lz9xhvsz1x7kt
Tags: 1.0.6-0ubuntu1
* New upstream release.
* debian/control:
  - dep on libglu1-mesa-dev
* debian/rules:
  - bump shlib

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
    : IOpenGLResource(RTVERTEXDECLARATION)
34
34
  {
35
35
    for(int i = 0; i < 8; i++)
 
36
    {
36
37
      _stride[i] = 0;
 
38
      vertex_buffer_array.push_back(ObjectPtr<IOpenGLVertexBuffer>(NULL));
 
39
    }
37
40
 
38
41
    int index = 0;
39
42
    _declarations_array.clear();
72
75
  VERTEXELEMENT IOpenGLVertexDeclaration::GetUsage (ATTRIB_USAGE_DECL usage)
73
76
  {
74
77
    VERTEXELEMENT vtxelt;
75
 
    vtxelt.Stream = 0xFF; // invalid stream;
76
 
 
77
 
    for (unsigned int i = 0; _declarations_array.size(); i++)
78
 
    {
79
 
      if (_declarations_array[i].Usage == usage)
80
 
      {
81
 
        vtxelt = _declarations_array[i];
82
 
        return vtxelt;
83
 
      }
84
 
    }
85
 
 
86
78
    return vtxelt;
 
79
//     vtxelt.Stream = 0xFF; // invalid stream;
 
80
// 
 
81
//     for (unsigned int i = 0; _declarations_array.size(); i++)
 
82
//     {
 
83
//       if (_declarations_array[i].Usage == usage)
 
84
//       {
 
85
//         vtxelt = _declarations_array[i];
 
86
//         return vtxelt;
 
87
//       }
 
88
//     }
 
89
// 
 
90
//     return vtxelt;
87
91
  }
88
92
 
89
93
// This is a simple check to comply with the documentation of DrawPrimitiveUP in DirectX
100
104
    return false;
101
105
  }
102
106
 
 
107
  int IOpenGLVertexDeclaration::GetStride(int vertex_input_number)
 
108
  {
 
109
    NUX_RETURN_VALUE_IF_FALSE(vertex_input_number >= 0, 0);
 
110
    NUX_RETURN_VALUE_IF_FALSE(vertex_input_number < 8, 0);
 
111
 
 
112
    return _stride[vertex_input_number];
 
113
  }
 
114
 
 
115
 
 
116
  void IOpenGLVertexDeclaration::SetVertexBuffer(int input_index, ObjectPtr<IOpenGLVertexBuffer> vertex_buffer)
 
117
  {
 
118
    NUX_RETURN_IF_FALSE(input_index >= 0);
 
119
    NUX_RETURN_IF_FALSE(input_index < 8);
 
120
 
 
121
    vertex_buffer_array[input_index] = vertex_buffer;
 
122
  }
 
123
 
 
124
  ObjectPtr<IOpenGLVertexBuffer> IOpenGLVertexDeclaration::GetVertexBuffer(int input_index)
 
125
  {
 
126
    NUX_RETURN_VALUE_IF_FALSE(input_index >= 0, ObjectPtr<IOpenGLVertexBuffer>(NULL));
 
127
    NUX_RETURN_VALUE_IF_FALSE(input_index < 8, ObjectPtr<IOpenGLVertexBuffer>(NULL));
 
128
 
 
129
    return vertex_buffer_array[input_index];
 
130
  }
 
131
 
 
132
  void IOpenGLVertexDeclaration::SetVertexShaderAttributeLocation(int input_index, int shader_attribute_location)
 
133
  {
 
134
    NUX_RETURN_IF_FALSE(input_index >= 0);
 
135
    NUX_RETURN_IF_FALSE(input_index < 8);
 
136
 
 
137
    shader_attribute_location_array[input_index] = shader_attribute_location;
 
138
  }
 
139
 
 
140
  int IOpenGLVertexDeclaration::GetVertexShaderAttributeLocation(int input_index)
 
141
  {
 
142
    NUX_RETURN_VALUE_IF_FALSE(input_index >= 0, -1);
 
143
    NUX_RETURN_VALUE_IF_FALSE(input_index < 8, -1);
 
144
 
 
145
    return shader_attribute_location_array[input_index];
 
146
  }
103
147
}