コード例 #1
0
ファイル: heightmap.c プロジェクト: chc4/IntenseLogic
static void heightmap_draw(void *ptr)
{
    ilG_testError("Unknown");
    ilG_heightmap *self = ptr;
    ilG_tex_bind(&self->height);
    ilG_tex_bind(&self->normal);
    ilG_tex_bind(&self->color);
    ilG_bindable_bind(&ilG_mesh_bindable, self->drawable);
    ilG_bindable_bind(&ilG_material_bindable, self->shader);
    for (unsigned i = 0; i < self->positionables.length; i++) {
        self->context->positionable = &self->positionables.data[i];
        ilG_bindable_action(&ilG_material_bindable, self->shader);
        ilG_bindable_action(&ilG_mesh_bindable, self->drawable);
    }
    ilG_testError("heightmap_draw");
}
コード例 #2
0
ファイル: geometrypass.c プロジェクト: Ralith/IntenseLogic
static void draw_geometry(ilG_stage *self)
{
    ilG_testError("Unknown");
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_CULL_FACE);
    glDisable(GL_BLEND);
    glFrontFace(GL_CCW);
    glCullFace(GL_BACK);
    ilG_testError("glEnable");
    ilG_testError("Error setting up for draw");

    ilG_context *context = self->context;
    struct timeval tv;
    il_positionable* pos = NULL;
    ilG_trackiterator * iter = ilG_trackiterator_new(context);
    gettimeofday(&tv, NULL);
    //const ilG_bindable *drawable = NULL, *material = NULL, *texture = NULL;

    while (ilG_trackIterate(iter)) {
        pos = ilG_trackGetPositionable(iter);
        context->positionable = pos;

        ilG_drawable3d *drawable = ilG_trackGetDrawable(iter);
        if (ILG_TESTATTR(drawable->attrs, ILG_ARRATTR_ISTRANSPARENT)) {
            continue;
        }
        ilG_bindable_swap(&context->drawableb, (void**)&context->drawable, drawable);
        ilG_bindable_swap(&context->materialb, (void**)&context->material, ilG_trackGetMaterial(iter));
        ilG_bindable_swap(&context->textureb,  (void**)&context->texture,  ilG_trackGetTexture(iter));

        ilG_bindable_action(context->materialb, context->material);
        ilG_bindable_action(context->textureb,  context->texture);
        ilG_bindable_action(context->drawableb, context->drawable);
    }
    ilG_bindable_unbind(context->materialb, context->material);
    ilG_bindable_unbind(context->textureb,  context->texture);
    ilG_bindable_unbind(context->drawableb, context->drawable);
    context->drawable = NULL;
    context->material = NULL;
    context->texture = NULL;
    context->drawableb = NULL;
    context->materialb = NULL;
    context->textureb = NULL;
}