1 Index: libs/picomodel/picomodel.c
2 ===================================================================
3 --- libs/picomodel/picomodel.c (revision 191)
4 +++ libs/picomodel/picomodel.c (working copy)
6 model = PicoModuleLoadModel(module, fileName, buffer, bufSize, frameNum);
21 +// Sys_Printf(" %f %f %f\n", normal[0] , normal[1] , normal[2] );
24 if( surface == NULL || surface->numVertexes <= 0 )
25 @@ -1861,13 +1859,10 @@
26 typedef picoVec3_t* picoNormalIter_t;
27 typedef picoIndex_t* picoIndexIter_t;
29 -#define THE_CROSSPRODUCTS_OF_ANY_PAIR_OF_EDGES_OF_A_GIVEN_TRIANGLE_ARE_EQUAL 1
31 void _pico_triangles_generate_weighted_normals(picoIndexIter_t first, picoIndexIter_t end, picoVec3_t* xyz, picoVec3_t* normals)
33 for(; first != end; first += 3)
35 -#if (THE_CROSSPRODUCTS_OF_ANY_PAIR_OF_EDGES_OF_A_GIVEN_TRIANGLE_ARE_EQUAL)
36 picoVec3_t weightedNormal;
38 float* a = xyz[*(first + 0)];
39 @@ -1878,24 +1873,11 @@
40 _pico_subtract_vec( c, a, ca );
41 _pico_cross_vec( ca, ba, weightedNormal );
48 float* normal = normals[*(first + j)];
49 -#if (!THE_CROSSPRODUCTS_OF_ANY_PAIR_OF_EDGES_OF_A_GIVEN_TRIANGLE_ARE_EQUAL)
50 - picoVec3_t weightedNormal;
52 - float* a = xyz[*(first + ((j + 0) % 3))];
53 - float* b = xyz[*(first + ((j + 1) % 3))];
54 - float* c = xyz[*(first + ((j + 2) % 3))];
56 - _pico_subtract_vec( b, a, ba );
57 - _pico_subtract_vec( c, a, ca );
58 - _pico_cross_vec( ca, ba, weightedNormal );
61 _pico_add_vec(weightedNormal, normal, normal);
66 for(; first != last; ++first, ++generated)
68 - if(!_pico_normal_is_unit_length(*first) || !_pico_normal_within_tolerance(*first, *generated))
69 + //27 - fix for badly generated normals thing.
70 + // if(!_pico_normal_is_unit_length(*first) || !_pico_normal_within_tolerance(*first, *generated))
72 _pico_copy_vec(*generated, *first);
74 @@ -1954,10 +1937,11 @@
76 _pico_normals_zero(normals, normals + surface->numVertexes);
78 + //Just build standard no sg normals for now
79 _pico_triangles_generate_weighted_normals(surface->index, surface->index + surface->numIndexes, surface->xyz, normals);
80 _pico_vertices_combine_shared_normals(surface->xyz, surface->smoothingGroup, normals, surface->numVertexes);
82 - _pico_normals_normalize(normals, normals + surface->numVertexes);
83 + _pico_normals_normalize(normals, normals + surface->numVertexes);
85 _pico_normals_assign_generated_normals(surface->normal, surface->normal + surface->numVertexes, normals);
88 int newVertIndex = PicoGetSurfaceNumIndexes ( workSurface );
90 /* get the index of the vertex that we're going to store at newVertIndex */
91 - vertDataIndex = PicoFindSurfaceVertexNum ( workSurface , *xyz[i] , *normals[i] , numSTs , st[i] , numColors , colors[i], smoothingGroup[i]);
92 + vertDataIndex = -1;// PicoFindSurfaceVertexNum ( workSurface , *xyz[i] , *normals[i] , numSTs , st[i] , numColors , colors[i], smoothingGroup[i]);
94 /* the vertex wasn't found, so create a new vertex in the pool from the data we have */
95 if ( vertDataIndex == -1 )
97 PicoSetSurfaceIndex ( workSurface , newVertIndex , vertDataIndex );