Esempio n. 1
0
vertex3f vertex3f::operator/(const vertex3f &op) const {
    return vertex3f(
            vec[0] / op.vec[0],
            vec[1] / op.vec[1],
            vec[2] / op.vec[2]
    );
}
Esempio n. 2
0
vertex3f vertex3f::vector_mult(const vertex3f &op) const {
    return vertex3f(
            (vec[1] * op.vec[2] - op.vec[1] * vec[2]),
            -(vec[0] * op.vec[2] - op.vec[0] * vec[2]),
            (vec[0] * op.vec[1] - op.vec[0] * vec[1])
    );
}
Esempio n. 3
0
void LLRender::vertex3fv(const GLfloat* v)
{
	vertex3f(v[0], v[1], v[2]);
}
Esempio n. 4
0
void LLRender::vertex2f(const GLfloat& x, const GLfloat& y)
{ 
	vertex3f(x,y,0);
}
Esempio n. 5
0
void LLRender::vertex2i(const GLint& x, const GLint& y)
{
	vertex3f((GLfloat) x, (GLfloat) y, 0);	
}
Esempio n. 6
0
//torch
void MechListMeshRenderer::push_render_mesh(const struct Mech &m)
{

/*
    static const float vin[72] =
    {
        1,1,1, 0,1,1, 0,0,1, 1,0,1, //top
        0,1,0, 1,1,0, 1,0,0, 0,0,0, //bottom
        1,0,1, 1,0,0, 1,1,0, 1,1,1, //north
        0,1,1, 0,1,0, 0,0,0, 0,0,1, //south
        1,1,1, 1,1,0, 0,1,0, 0,1,1, //west
        0,0,1, 0,0,0, 1,0,0, 1,0,1  //east
    };
*/

    static class MeshInstance* MI; // load_mesh(const char* filename)
    static class MeshLoader* ML = NULL;
    if(ML == NULL)
    {
        printf("loading mesh: \n");
        ML = new MeshLoader;
        MI = ML->load_mesh(MEDIA_PATH "sprites/mech/mesh/light_rod.mesh");
    }

#if !PRODUCTION
    static int _counter = 0;
    _counter++;

    if(_counter % 60 == 1)
    {
        delete MI;
        MI = NULL;
        MI = ML->load_mesh(MEDIA_PATH "sprites/mech/mesh/light_rod.mesh");
    }
#endif

    float wx = m.position.x + 0.001f;
    float wy = m.position.y + 0.001;
    float wz = m.position.z + 0.0f;

    //fulstrum test
    const float cx = current_camera_position.x;
    const float cy = current_camera_position.y;

    wx = quadrant_translate_f(cx, wx);
    wy = quadrant_translate_f(cy, wy);

    if (!sphere_fulstrum_test(wx, wy, wz, 0.6f))
        return;

    int env_light = t_map::get_envlight(m.position);
    int sky_light = t_map::get_skylight(m.position);
    vertex_list.light(sky_light, env_light);

    const int imax = MI->van;
    const MeshInstance::Vertex* va = MI->va;
    for(int i=0; i<imax; i++)
    {
        vertex_list.vertex3f(wx+va[i].x, wy+va[i].y, wz+va[i].z);
        vertex_list.tex2f(va[i].tx, va[i].ty);
        vertex_list.push_vertex();
    }

}
Esempio n. 7
0
vertex3f vertex3f::add(const vertex3f &op) const {
    return vertex3f(
            vec[0] + op.vec[0],
            vec[1] + op.vec[1],
            vec[2] + op.vec[2]);
}
Esempio n. 8
0
vertex3f vertex3f::sub(const vertex3f &op) const {
    return vertex3f(
            vec[0] - op.vec[0],
            vec[1] - op.vec[1],
            vec[2] - op.vec[2]);
}
Esempio n. 9
0
vertex3f vertex3f::mult(const float op) const {
    return vertex3f(
            op * vec[0],
            op * vec[1],
            op * vec[2]);
}
Esempio n. 10
0
vertex3f vertex3f::div(const float op) const {
    return vertex3f(
            vec[0] / op,
            vec[1] / op,
            vec[2] / op);
}
Esempio n. 11
0
vertex3f vertex3f::rotate(const vertex3f &a1, const vertex3f &a2, const vertex3f &a3) const {
    vertex3f temp(vec[0], vec[1], vec[2]);
    return vertex3f(temp * a1, temp * a2, temp * a3);

//    return a1*vec[0]+a2*vec[1]+a3*vec[2];
}
Esempio n. 12
0
vertex3f vertex3f::product_be(const vertex3f &op) const {
    return vertex3f(vec[0] * op.vec[0], vec[1] * op.vec[1], vec[2] * op.vec[2]);
}