Mirobot::Mirobot(){ mainInstance = this; blocking = true; nextADCRead = 0; beepComplete = 0; initCmds(); }
void consoleInit() { utilStrRealloc(&consoleStatus, 0, 32); *consoleStatus='\0'; initCmds(); }
void main(int argc, char **argv) { // init GLUT and create window glutInit(&argc, argv); glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); glutInitWindowPosition(100,100); glutInitWindowSize(1440,900); glutCreateWindow("Three Dee Warudo - Tutorial"); initCmds(); // register callbacks glutDisplayFunc(renderScene); glutReshapeFunc(changeSize); glutIdleFunc(renderScene); glutPassiveMotionFunc(MouseMotion); glutMotionFunc(MouseMotion); glutMouseFunc(MouseClick); glutKeyboardFunc(KeyDn); glutKeyboardUpFunc(KeyUp); glutSpecialFunc(SKeyDn); glutSpecialUpFunc(SKeyUp); glutIgnoreKeyRepeat(1); // OpenGL init glEnable(GL_DEPTH_TEST); glewInit(); WFModelFactory::Instance()->Set_Resource_loc("3DeeModel/","textures/wdworld/"); ShaderMode::Instance()->Set_ShaderMode(GLSL); testVBO = new ThreeDeeModel("wardroid.obj");testVBO->Set_Shader("point"); deadworld = new ThreeDeeModel("deadworld.obj");deadworld->Set_Shader("point"); wardroid = new ThreeDeeModel("wardroid.obj");wardroid->Set_Shader("point"); rocket = new ThreeDeeModel("rocket.obj");rocket->Set_Shader("simple"); ShaderFactory* _SF = ShaderFactory::Instance(); ShaderManager* _SM = ShaderManager::Instance(); UniformVarFactory* _UVF = UniformVarFactory::Instance(); _SM->Add_Shader_program("point",_SF->Create("Shaders/point_light.vert","Shaders/point_light.frag")); _SM->Set_Shader_uni_var("point", _UVF->Create("LightPos",&light_pos)); _SM->Set_Shader_uni_var("point", _UVF->Create("Brightness",new float(3.0f))); /*_SM->Set_Shader_uni_var(0, _UVF->Create("BaseColor",new Vec3f(1.0f,0.4f,1.0f)));*/ /*_SM->Set_Shader_uni_var(0, _UVF->Create("MixRatio",new float(1.0f))); _SM->Set_Shader_uni_var(0, _UVF->Create("EnvMap",new float(4.0f)));*/ _SM->Add_Shader_program("brick",_SF->Create("Shaders/brick.vert","Shaders/brick.frag")); _SM->Set_Shader_uni_var("brick", _UVF->Create("BrickColor",new Vec3f(1.0f, 1.0f, 1.0f))); _SM->Set_Shader_uni_var("brick", _UVF->Create("MortarColor",new Vec3f(0.0f, 1.0f, 1.0f))); _SM->Set_Shader_uni_var("brick", _UVF->Create("BrickSize",new Vector2<float>(0.30f,0.15f))); _SM->Set_Shader_uni_var("brick", _UVF->Create("BrickPct",new Vector2<float>(0.90f, 0.85f))); /*_SM->Set_Shader_uni_var(1, _UVF->Create("LightPosition",&light_pos));*/ _SM->Add_Shader_program("simple",_SF->Create("Shaders/simpletex.vert","Shaders/simpletex.frag")); _SM->Add_Shader_program("heat",_SF->Create("Shaders/heathaze.vert","Shaders/heathaze.frag")); _SM->Set_Shader_uni_var("heat", _UVF->Create("FrameBuffer",&ID)); _SM->Set_Shader_uni_var("heat", _UVF->Create("FrameWidth",new float(2048))); _SM->Set_Shader_uni_var("heat", _UVF->Create("FrameHeight",new float(2048))); _SM->Set_Shader_uni_var("heat", _UVF->Create("Frequency",&frequency)); _SM->Set_Shader_uni_var("heat", _UVF->Create("Speed",&speed)); _SM->Set_Shader_uni_var("heat", _UVF->Create("Fade",&fade)); _SM->Set_Shader_uni_var("heat", _UVF->Create("Offset",&offset)); // enter GLUT event processing cycle glutMainLoop(); }