Subversion Repositories Games.Carmageddon

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. #include "stored_context.h"
  2. #include "../include/harness/trace.h"
  3. #include <stdlib.h>
  4.  
  5. void _free(br_object* o) {
  6.     tStored_model_context* ctx = (tStored_model_context*)o;
  7.     glDeleteVertexArrays(1, &ctx->vao_id);
  8.     glDeleteBuffers(1, &ctx->vbo_id);
  9.     glDeleteBuffers(1, &ctx->ebo_id);
  10.     free(o);
  11. }
  12.  
  13. br_object_dispatch dispatch_funcs = {
  14.     NULL,
  15.     NULL,
  16.     NULL,
  17.     NULL,
  18.     _free,
  19.     NULL,
  20.     NULL,
  21.     NULL,
  22.     NULL,
  23.     NULL,
  24.     NULL,
  25.     NULL,
  26.     NULL,
  27.     NULL,
  28.     NULL,
  29.     NULL,
  30.     NULL
  31. };
  32.  
  33. tStored_model_context* NewStoredModelContext(void) {
  34.     tStored_model_context* ctx = malloc(sizeof(tStored_model_context));
  35.     ctx->dispatch = &dispatch_funcs;
  36.     return ctx;
  37. }
  38.  
  39. tStored_material* NewStoredMaterial(void) {
  40.     tStored_material* ctx = malloc(sizeof(tStored_material));
  41.     ctx->index_base = -1;
  42.     ctx->pixelmap = NULL;
  43.     ctx->shade_table = NULL;
  44.     ctx->index_blend = NULL;
  45.     ctx->identifier[0] = '\0';
  46.     return ctx;
  47. }
  48.  
  49. tStored_pixelmap* NewStoredPixelmap(void) {
  50.     tStored_pixelmap* ctx = malloc(sizeof(tStored_pixelmap));
  51.     ctx->id = 0;
  52.     return ctx;
  53. }
  54.