예제 #1
0
파일: cvector.c 프로젝트: rig-project/clib
float *
c_vector4_copy (float *vector)
{
    if (vector)
        return c_slice_copy(sizeof(float) * 4, vector);
    return NULL;
}
예제 #2
0
파일: cvector.c 프로젝트: rig-project/clib
float *
c_vector3_copy(const float *vector)
{
    if (vector)
        return c_slice_copy(sizeof(float) * 3, vector);
    return NULL;
}
예제 #3
0
void
rut_mesh_set_attributes(rut_mesh_t *mesh,
                        rut_attribute_t **attributes,
                        int n_attributes)
{
    rut_attribute_t **attributes_real = attributes ?
        c_slice_copy(sizeof(void *) * n_attributes, attributes) : NULL;
    int i;

    /* NB: some of the given attributes may be the same as
     * some of the current attributes so we ref before
     * unrefing to avoid destroying any of them. */
    for (i = 0; i < n_attributes; i++)
        rut_object_ref(attributes[i]);

    for (i = 0; i < mesh->n_attributes; i++)
        rut_object_unref(mesh->attributes[i]);

    mesh->attributes = attributes_real;
    mesh->n_attributes = n_attributes;
}