Esempio n. 1
0
// temporary
bool OnLoadCustomShapeResource(ResourceBase* pRes, void* pData)
{
    CollisionShape* pShape = (CollisionShape*)pRes;

    if (strcmp(pShape->GetName(), "shape_floor") == 0)
    {
        pShape->AddBox(Vector(100.0f, 10.0f, 100.0f), MatrixIdentity());
    }
    else if (strcmp(pShape->GetName(), "shape_box") == 0)
    {
        pShape->AddBox(Vector(0.25f, 0.25f, 0.25f), MatrixIdentity());
    }
    else if (strcmp(pShape->GetName(), "shape_frame") == 0)
    {
        // Z axis
        pShape->AddBox(Vector(0.025f, 0.025f, 0.45f), MatrixTranslation3(Vector(-0.475f, -0.475f, 0.0f)));
        pShape->AddBox(Vector(0.025f, 0.025f, 0.45f), MatrixTranslation3(Vector(-0.475f, 0.475f, 0.0f)));
        pShape->AddBox(Vector(0.025f, 0.025f, 0.45f), MatrixTranslation3(Vector(0.475f, -0.475f, 0.0f)));
        pShape->AddBox(Vector(0.025f, 0.025f, 0.45f), MatrixTranslation3(Vector(0.475f, 0.475f, 0.0f)));

        // Y axis
        pShape->AddBox(Vector(0.025f, 0.5f, 0.025f), MatrixTranslation3(Vector(-0.475f, 0.0f, -0.475f)));
        pShape->AddBox(Vector(0.025f, 0.5f, 0.025f), MatrixTranslation3(Vector(-0.475f, 0.0f, 0.475f)));
        pShape->AddBox(Vector(0.025f, 0.5f, 0.025f), MatrixTranslation3(Vector(0.475f, 0.0f, -0.475f)));
        pShape->AddBox(Vector(0.025f, 0.5f, 0.025f), MatrixTranslation3(Vector(0.475f, 0.0f, 0.475f)));

        // X axis
        pShape->AddBox(Vector(0.5f, 0.025f, 0.025f), MatrixTranslation3(Vector(0.0f, -0.475f, -0.475f)));
        pShape->AddBox(Vector(0.5f, 0.025f, 0.025f), MatrixTranslation3(Vector(0.0f, -0.475f, 0.475f)));
        pShape->AddBox(Vector(0.5f, 0.025f, 0.025f), MatrixTranslation3(Vector(0.0f, 0.475f, -0.475f)));
        pShape->AddBox(Vector(0.5f, 0.025f, 0.025f), MatrixTranslation3(Vector(0.0f, 0.475f, 0.475f)));
    }
    else if (strcmp(pShape->GetName(), "shape_barrel") == 0)
    {
        pShape->AddCylinder(1.31f, 0.421f);
    }

    return true;
}