Preallocate proper ssg list sizes when building list structures so plib
doesn't need to waste time extending it's list sizes.
This commit is contained in:
parent
a4c06de42f
commit
4496bf341d
1 changed files with 13 additions and 13 deletions
|
@ -58,8 +58,8 @@ ssgLeaf *gen_directional_light( sgVec3 pt, sgVec3 dir, sgVec3 up,
|
||||||
sgVectorProductVec3( perp, dir, up );
|
sgVectorProductVec3( perp, dir, up );
|
||||||
|
|
||||||
ssgVertexArray *vl = new ssgVertexArray( 3 );
|
ssgVertexArray *vl = new ssgVertexArray( 3 );
|
||||||
ssgNormalArray *nl = new ssgNormalArray( 1 );
|
ssgNormalArray *nl = new ssgNormalArray( 3 );
|
||||||
ssgColourArray *cl = new ssgColourArray( 1 );
|
ssgColourArray *cl = new ssgColourArray( 3 );
|
||||||
|
|
||||||
// front face
|
// front face
|
||||||
sgVec3 tmp3;
|
sgVec3 tmp3;
|
||||||
|
@ -143,9 +143,9 @@ ssgLeaf *gen_dir_light_group( const point_list &nodes,
|
||||||
sgVec3 nup;
|
sgVec3 nup;
|
||||||
sgNormalizeVec3( nup, up );
|
sgNormalizeVec3( nup, up );
|
||||||
|
|
||||||
ssgVertexArray *vl = new ssgVertexArray( 3 );
|
ssgVertexArray *vl = new ssgVertexArray( 3 * pnt_i.size() );
|
||||||
ssgNormalArray *nl = new ssgNormalArray( 3 );
|
ssgNormalArray *nl = new ssgNormalArray( 3 * pnt_i.size() );
|
||||||
ssgColourArray *cl = new ssgColourArray( 3 );
|
ssgColourArray *cl = new ssgColourArray( 3 * pnt_i.size() );
|
||||||
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
sgVec3 pt, normal;
|
sgVec3 pt, normal;
|
||||||
|
@ -210,9 +210,9 @@ ssgTimedSelector *gen_reil_lights( const point_list &nodes,
|
||||||
sgVec3 nup;
|
sgVec3 nup;
|
||||||
sgNormalizeVec3( nup, up );
|
sgNormalizeVec3( nup, up );
|
||||||
|
|
||||||
ssgVertexArray *vl = new ssgVertexArray( 6 );
|
ssgVertexArray *vl = new ssgVertexArray( 3 * pnt_i.size() );
|
||||||
ssgNormalArray *nl = new ssgNormalArray( 6 );
|
ssgNormalArray *nl = new ssgNormalArray( 3 * pnt_i.size() );
|
||||||
ssgColourArray *cl = new ssgColourArray( 6 );
|
ssgColourArray *cl = new ssgColourArray( 3 * pnt_i.size() );
|
||||||
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
sgVec3 pt, normal;
|
sgVec3 pt, normal;
|
||||||
|
@ -296,9 +296,9 @@ ssgTimedSelector *gen_rabbit_lights( const point_list &nodes,
|
||||||
int i;
|
int i;
|
||||||
sgVec3 pt, normal;
|
sgVec3 pt, normal;
|
||||||
for ( i = (int)pnt_i.size() - 1; i >= 0; --i ) {
|
for ( i = (int)pnt_i.size() - 1; i >= 0; --i ) {
|
||||||
ssgVertexArray *vl = new ssgVertexArray( 3 );
|
ssgVertexArray *vl = new ssgVertexArray( 3 * pnt_i.size() );
|
||||||
ssgNormalArray *nl = new ssgNormalArray( 3 );
|
ssgNormalArray *nl = new ssgNormalArray( 3 * pnt_i.size() );
|
||||||
ssgColourArray *cl = new ssgColourArray( 3 );
|
ssgColourArray *cl = new ssgColourArray( 3 * pnt_i.size() );
|
||||||
|
|
||||||
sgSetVec3( pt, nodes[pnt_i[i]][0], nodes[pnt_i[i]][1],
|
sgSetVec3( pt, nodes[pnt_i[i]][0], nodes[pnt_i[i]][1],
|
||||||
nodes[pnt_i[i]][2] );
|
nodes[pnt_i[i]][2] );
|
||||||
|
@ -366,8 +366,8 @@ ssgTimedSelector *gen_rabbit_lights( const point_list &nodes,
|
||||||
ssgLeaf *gen_normal_line( sgVec3 pt, sgVec3 dir, sgVec3 up ) {
|
ssgLeaf *gen_normal_line( sgVec3 pt, sgVec3 dir, sgVec3 up ) {
|
||||||
|
|
||||||
ssgVertexArray *vl = new ssgVertexArray( 3 );
|
ssgVertexArray *vl = new ssgVertexArray( 3 );
|
||||||
ssgNormalArray *nl = new ssgNormalArray( 1 );
|
ssgNormalArray *nl = new ssgNormalArray( 3 );
|
||||||
ssgColourArray *cl = new ssgColourArray( 1 );
|
ssgColourArray *cl = new ssgColourArray( 3 );
|
||||||
|
|
||||||
sgVec3 tmp3;
|
sgVec3 tmp3;
|
||||||
sgCopyVec3( tmp3, pt );
|
sgCopyVec3( tmp3, pt );
|
||||||
|
|
Loading…
Add table
Reference in a new issue