void
lib3ds_shadow_read(Lib3dsShadow *shadow, Lib3dsIo *io) {
    Lib3dsChunk c;

    lib3ds_chunk_read(&c, io);
    switch (c.chunk) {
        case CHK_SHADOW_MAP_SIZE: {
            shadow->map_size = lib3ds_io_read_intw(io);
            break;
        }

        case CHK_LO_SHADOW_BIAS: {
            shadow->low_bias = lib3ds_io_read_float(io);
            break;
        }

        case CHK_HI_SHADOW_BIAS: {
            shadow->hi_bias = lib3ds_io_read_float(io);
            break;
        }

        case CHK_SHADOW_FILTER: {
            shadow->filter = lib3ds_io_read_float(io);
            break;
        }

        case CHK_RAY_BIAS: {
            shadow->ray_bias = lib3ds_io_read_float(io);
            break;
        }
    }
}
void
lib3ds_chunk_read_start(Lib3dsChunk *c, uint16_t chunk, Lib3dsIo *io) {
    assert(c);
    assert(io);
    lib3ds_chunk_read(c, io);
    if ((chunk != 0) && (c->chunk != chunk)) {
        lib3ds_io_log(io, LIB3DS_LOG_ERROR, "Unexpected chunk found.");
    }
    ((Lib3dsIoImpl*)io->impl)->log_indent++;
}
/*!
 * \ingroup chunk
 */
Lib3dsBool
lib3ds_chunk_read_start(Lib3dsChunk *c, Lib3dsWord chunk, Lib3dsIo *io)
{
  ASSERT(c);
  ASSERT(io);
  if (!lib3ds_chunk_read(c, io)) {
    return(LIB3DS_FALSE);
  }
  lib3ds_chunk_debug_enter(c);
  return((chunk==0) || (c->chunk==chunk));
}
Beispiel #4
0
/*!
 * \ingroup atmosphere
 */
Lib3dsBool
lib3ds_atmosphere_read(Lib3dsAtmosphere *atmosphere, Lib3dsIo *io)
{
  Lib3dsChunk c;

  if (!lib3ds_chunk_read(&c, io)) {
    return(LIB3DS_FALSE);
  }
  
  switch (c.chunk) {
      case LIB3DS_FOG:
        {
          lib3ds_chunk_read_reset(&c, io);
          if (!fog_read(&atmosphere->fog, io)) {
            return(LIB3DS_FALSE);
          }
        }
        break;
      case LIB3DS_LAYER_FOG:
        {
          lib3ds_chunk_read_reset(&c, io);
          if (!layer_fog_read(&atmosphere->layer_fog, io)) {
            return(LIB3DS_FALSE);
          }
        }
        break;
      case LIB3DS_DISTANCE_CUE:
        {
          lib3ds_chunk_read_reset(&c, io);
          if (!distance_cue_read(&atmosphere->dist_cue, io)) {
            return(LIB3DS_FALSE);
          }
        }
        break;
      case LIB3DS_USE_FOG:
        {
          atmosphere->fog.use=LIB3DS_TRUE;
        }
        break;
      case LIB3DS_USE_LAYER_FOG:
        {
          atmosphere->fog.use=LIB3DS_TRUE;
        }
        break;
      case LIB3DS_USE_DISTANCE_CUE:
        {
          atmosphere->dist_cue.use=LIB3DS_TRUE;
        }
        break;
  }

  return(LIB3DS_TRUE);
}
Beispiel #5
0
/*!
 * \ingroup background
 */
Lib3dsBool
lib3ds_background_read(Lib3dsBackground *background, Lib3dsIo *io)
{
  Lib3dsChunk c;

  if (!lib3ds_chunk_read(&c, io)) {
    return(LIB3DS_FALSE);
  }
  
  switch (c.chunk) {
    case LIB3DS_BIT_MAP:
      {
        if (!lib3ds_io_read_string(io, background->bitmap.name, 64)) {
            return(LIB3DS_FALSE);
        }
      }
      break;
    case LIB3DS_SOLID_BGND:
      {
        lib3ds_chunk_read_reset(&c, io);
        if (!solid_bgnd_read(background, io)) {
          return(LIB3DS_FALSE);
        }
      }
      break;
    case LIB3DS_V_GRADIENT:
      {
        lib3ds_chunk_read_reset(&c, io);
        if (!v_gradient_read(background, io)) {
          return(LIB3DS_FALSE);
        }
      }
      break;
    case LIB3DS_USE_BIT_MAP:
      {
        background->bitmap.use=LIB3DS_TRUE;
      }
      break;
    case LIB3DS_USE_SOLID_BGND:
      {
        background->solid.use=LIB3DS_TRUE;
      }
      break;
    case LIB3DS_USE_V_GRADIENT:
      {
        background->gradient.use=LIB3DS_TRUE;
      }
      break;
  }
  
  return(LIB3DS_TRUE);
}
Beispiel #6
0
/*!
 * \ingroup shadow 
 */
Lib3dsBool
lib3ds_shadow_read(Lib3dsShadow *shadow, Lib3dsIo *io)
{
  Lib3dsChunk c;

  if (!lib3ds_chunk_read(&c, io)) {
    return(LIB3DS_FALSE);
  }
  
  switch (c.chunk) {
    case LIB3DS_SHADOW_MAP_SIZE:
      {
        shadow->map_size=lib3ds_io_read_intw(io);
      }
      break;
    case LIB3DS_LO_SHADOW_BIAS:
      {
          shadow->lo_bias=lib3ds_io_read_float(io);
      }
      break;
    case LIB3DS_HI_SHADOW_BIAS:
      {
        shadow->hi_bias=lib3ds_io_read_float(io);
      }
      break;
    case LIB3DS_SHADOW_SAMPLES:
      {
        shadow->samples=lib3ds_io_read_intw(io);
      }
      break;
    case LIB3DS_SHADOW_RANGE:
      {
        shadow->range=lib3ds_io_read_intd(io);
      }
      break;
    case LIB3DS_SHADOW_FILTER:
      {
        shadow->filter=lib3ds_io_read_float(io);
      }
      break;
    case LIB3DS_RAY_BIAS:
      {
        shadow->ray_bias=lib3ds_io_read_float(io);
      }
      break;
  }
  
  return(LIB3DS_TRUE);
}
void
lib3ds_atmosphere_read(Lib3dsAtmosphere *atmosphere, Lib3dsIo *io)
{
    Lib3dsChunk c;

    lib3ds_chunk_read(&c, io);

    switch (c.chunk)
    {
    case CHK_FOG: {
        lib3ds_chunk_read_reset(&c, io);
        fog_read(atmosphere, io);
        break;
    }

    case CHK_LAYER_FOG: {
        lib3ds_chunk_read_reset(&c, io);
        layer_fog_read(atmosphere, io);
        break;
    }

    case CHK_DISTANCE_CUE: {
        lib3ds_chunk_read_reset(&c, io);
        distance_cue_read(atmosphere, io);
        break;
    }

    case CHK_USE_FOG: {
        atmosphere->use_fog = TRUE;
        break;
    }

    case CHK_USE_LAYER_FOG: {
        atmosphere->use_layer_fog = TRUE;
        break;
    }

    case CHK_USE_DISTANCE_CUE: {
        atmosphere->use_dist_cue = TRUE;
        break;
    }
    }
}
void
lib3ds_background_read(Lib3dsBackground *background, Lib3dsIo *io) {
    Lib3dsChunk c;

    lib3ds_chunk_read(&c, io);
    switch (c.chunk) {
        case CHK_BIT_MAP: {
            lib3ds_io_read_string(io, background->bitmap_name, 64);
            break;
        }

        case CHK_SOLID_BGND: {
            lib3ds_chunk_read_reset(&c, io);
            solid_bgnd_read(background, io);
            break;
        }

        case CHK_V_GRADIENT: {
            lib3ds_chunk_read_reset(&c, io);
            v_gradient_read(background, io);
            break;
        }

        case CHK_USE_BIT_MAP: {
            background->use_bitmap = TRUE;
            break;
        }

        case CHK_USE_SOLID_BGND: {
            background->use_solid = TRUE;
            break;
        }

        case CHK_USE_V_GRADIENT: {
            background->use_gradient = TRUE;
            break;
        }
    }
}