~glmark2-dev/glmark2/trunk

« back to all changes in this revision

Viewing changes to src/scene-bump.cpp

  • Committer: Jesse Barker
  • Date: 2013-02-01 17:21:16 UTC
  • mfrom: (259.1.7 obj-update)
  • Revision ID: jesse.barker@linaro.org-20130201172116-28iinauxsc19g3bv
Merge of lp:~glmark2-dev/glmark2/obj-update

Model: Adds more general support of the Wavefront .obj file format.  We still
only support triangular faces (the format itself allows for arbitrary polygonal
faces), however, we now support vertex normals and texcoords supplied with the
object, and the format actually allows for separate indexing into each of those
attribute lists, so those must be tracked and represented separately by Model
(both loading and when converting to Mesh).  We do not support any of the more
complex features of the file format like curves, free-form surfaces, and the
various material description options (separate file load and file format).

Show diffs side-by-side

added added

removed removed

Lines of Context:
80
80
    if(!model.load(poly_filename))
81
81
        return false;
82
82
 
83
 
    model.calculate_normals();
 
83
    if (model.needNormals())
 
84
        model.calculate_normals();
84
85
 
85
86
    /* Tell the converter that we only care about position and normal attributes */
86
87
    std::vector<std::pair<Model::AttribType, int> > attribs;
177
178
    if(!model.load("asteroid-low"))
178
179
        return false;
179
180
 
180
 
    model.calculate_normals();
 
181
    if (model.needNormals())
 
182
        model.calculate_normals();
181
183
 
182
184
    /* Calculate the half vector */
183
185
    LibMatrix::vec3 halfVector(lightPosition.x(), lightPosition.y(), lightPosition.z());
234
236
    if(!model.load("asteroid-low"))
235
237
        return false;
236
238
 
237
 
    model.calculate_normals();
 
239
    if (model.needNormals())
 
240
        model.calculate_normals();
238
241
 
239
242
    /* Calculate the half vector */
240
243
    LibMatrix::vec3 halfVector(lightPosition.x(), lightPosition.y(), lightPosition.z());