Commit d15edf3d authored by Seth Carter's avatar Seth Carter

Go ahead and also remove the scaling & offset arguments to s3dLoadObj. The...

Go ahead and also remove the scaling & offset arguments to s3dLoadObj. The same effect can be achieved through the world_transform matrix.
parent 34a38ec2
Pipeline #241521226 passed with stage
in 1 minute and 45 seconds
......@@ -275,7 +275,7 @@ struct s3dMesh
//float* vertices;
GLuint vertex_buffer,vertex_array;
uint32_t triangle_count;
GLcolor3 diffuse_color, ambient_color, specular_color;
GLfloat specular_exponent;
bool mag_filter_nearest; // if set to true, use GL_NEAREST as texture magnification filter. Otherwise use LINEAR.
......@@ -296,7 +296,7 @@ struct s3dModel
SDL_AtomicDecRef(&usages);
};
};
s3dModel* s3dLoadObj (char* basepath, char* filename, /* TEMPORARY: Will be removed! ---> */ s3dVec3 mesh_points_offset = s3dVec3(0), slScalar scaling = 1);
s3dModel* s3dLoadObj (char* basepath, char* filename);
s3dModel* s3dSpriteModel (slTexture* texref = NULL, objMaterial material = objFallbackMaterial);
struct s3dObject
......
......@@ -247,28 +247,6 @@ void s3dInitMeshBuffer (s3dMesh* mesh)
glVertexAttribPointer(0,3,GL_FLOAT,GL_FALSE,vertsize,offset); offset += sizeof(GLfloat) * 3;
glVertexAttribPointer(1,2,GL_FLOAT,GL_FALSE,vertsize,offset); offset += sizeof(GLfloat) * 2;
glVertexAttribPointer(2,3,GL_FLOAT,GL_FALSE,vertsize,offset); offset += sizeof(GLfloat) * 3;
};
void s3dApplyScalingAndOffset (float* vertices, int tricount, s3dVec3 mesh_points_offset, slScalar scaling)
{
/* Not bothering to make this use vector math etc. because eventually it
ought to be removed. Scaling & offset really should be done to the model
file itself, not calculated at load-time. */
float* vertexpointer = vertices;
for (uint32_t i = 0; i < tricount * 3; i++)
{
*vertexpointer++ *= scaling;
*vertexpointer++ *= scaling;
*vertexpointer++ *= scaling;
vertexpointer += 5; // texture coords
};
vertexpointer = vertices;
for (uint32_t i = 0; i < tricount * 3; i++)
{
*vertexpointer++ += mesh_points_offset.x;
*vertexpointer++ += mesh_points_offset.y;
*vertexpointer++ += mesh_points_offset.z;
vertexpointer += 5; // texture coords
};
}
s3dVec3 cross (s3dVec3 a, s3dVec3 b)
{
......@@ -314,8 +292,8 @@ s3dModel* s3dSpriteModel (slTexture* texref, objMaterial material)
mesh->mag_filter_nearest = material.mag_filter_nearest;
return model;
};
s3dModel* s3dLoadObj (char* basepath, char* filename, s3dVec3 mesh_points_offset, slScalar scaling)
}
s3dModel* s3dLoadObj (char* basepath, char* filename)
{
objModel* input = objLoad(basepath,filename);
if (!input) return NULL;
......@@ -454,8 +432,6 @@ s3dModel* s3dLoadObj (char* basepath, char* filename, s3dVec3 mesh_points_offset
s3dInitMeshBuffer(outmesh);
size_t vertices_size = sizeof(float) * 24 * tricount;
s3dApplyScalingAndOffset(vertices_buf,tricount,mesh_points_offset,scaling);
glBufferData(GL_ARRAY_BUFFER,vertices_size,vertices_buf,GL_STATIC_DRAW);
}
......@@ -463,7 +439,7 @@ s3dModel* s3dLoadObj (char* basepath, char* filename, s3dVec3 mesh_points_offset
objFree(input);
free(vertices_buf);
return output;
};
}
void s3dFreeModel (s3dModel* model)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment