Example #1
0
File: matrix.c Project: kogn/scft
/* When you can send the Wolfram System an EvaluatePacket[input], it
 *    may in general produce many packets in response, but the final
 *       packet should be ReturnPacket[output]. "Manipulating Expressions in
 *          External Programs" discusses how to handle sequences of packets and
 *             expressions whose structure you do not know in advance.  */
void skip_packets(WSLINK lp) {
    int pkt;
    while( (pkt = WSNextPacket( lp), pkt) && pkt != RETURNPKT) {
        WSNewPacket( lp);
        if (WSError( lp)) error( lp);
    }
}
Example #2
0
File: matrix.c Project: kogn/scft
void error( WSLINK lp){
    if( WSError( lp)){
        fprintf( stderr, "Error detected by WSTP: %s.\n",
                WSErrorMessage(lp));
    }else{
        fprintf( stderr, "Error detected by this program.\n");
    }
    exit(3);
}
Example #3
0
  Graphics::Graphics() 
  : camera_(nullptr),
    options_(nullptr),
    mat_stack_(nullptr),
    debug_buffer_(nullptr),
    repass_lights_(true),
    reset_scene_constants_(true),
    particle_manager_(nullptr),
    draw_ui_(false),
    System(ST_Graphics)
  {
    loaders_.insert(".obj", new ObjLoader());
    loaders_.insert(".bin", new BinLoader());

    mat_stack_ = new MatrixStack();

    camera_ = new Camera();
    options_ = new GraphicsOptions();

    particle_manager_ = new ParticleManager();

    switch (options_->Api)
    {
      case APIType::OpenGLAPI:
        //shit aint happening right now
        WSError("Yeah no OpenGL support yet sorry");
        break;
      case APIType::DirectX:
        graphicsAPI = new DirectX(); 
        break;
      default:
        WSError("What are you even what dude what. Whatever that is, we don't support it.");
        break;
    }
    scene_constants_.ambientIntensity = 0.5f;
    scene_constants_.ambientColor = Vector4(0.1f, 0.1f, 0.1f, 1.0f);
  }