bool ERNRenderer::Render (int Width, int Height) { ++m_FrameCount; clock_t Now = clock (); if (m_LastTime == 0) m_LastTime = Now; if (m_iterate) { m_y_rotation += 45.0f * ((float)(Now - m_LastTime) / CLOCKS_PER_SEC); } m_ModelMatrix = lqc::IDENTITY_MATRIX; lqc::TranslateMatrix (&m_ModelMatrix, -(m_cube_width / 2.0f), -(m_cube_height / 2.0f), -(m_cube_depth / 2.0f)); lqc::RotateAboutX (&m_ModelMatrix, m_x_rotation * (float)PI / 180.0f); lqc::RotateAboutY (&m_ModelMatrix, m_y_rotation * (float)PI / 180.0f); m_glfbo->Bind (); FirstPass (); SecondPass (); m_glfbo->renderBuffer (Width, Height, 0); GBuffer::Unbind (); m_LastTime = Now; return true; }
///////////////////////////////////////////////////////////////////////////////////// // Controller function to perform 2 pass parsing. void Executive::AnalyzeFiles() { FirstPass(); DataStore::setParseMode(DataStore::SECOND_PASS); // Change mode to ignore 1st Pass Operations not required in 2nd pass. SecondPass(); }
/*this program is a two pass assambler , without linker/loader support this project was written by - tomer zilka and jacob (koby) kili*/ int main(int argc,char* argv[]) { char **fileNames=ObtainFileNames(argc-1,argv); FirstPass(fileNames,argc-1); if(WasThereCompilingError()==TRUE) printf("There were compiling errors, cannot continue to second pass\n"); else SecondPass(fileNames[0]); return 1; }
void Material::Pass(int pass) { if (pass == 0) { FirstPass(blendType); } else { SecondPass(blendType); } }
/** * Load an OBJ model from file, in two passes. */ int ReadOBJModel (const char *filename, struct obj_model_t *mdl) { FILE *fp; fp = fopen (filename, "r"); if (!fp) { fprintf (stderr, "Error: couldn't open \"%s\"!\n", filename); return 0; } /* reset model data */ memset (mdl, 0, sizeof (struct obj_model_t)); /* first pass: read model info */ if (!FirstPass (fp, mdl)) { fclose (fp); return 0; } rewind (fp); /* memory allocation */ if (!MallocModel (mdl)) { fclose (fp); FreeModel (mdl); return 0; } /* second pass: read model data */ if (!SecondPass (fp, mdl)) { fclose (fp); FreeModel (mdl); return 0; } fclose (fp); return 1; }
/** * Load an OBJ model from file, in two passes. */ int LoadOBJ::ReadOBJModel (const char *filename) { FILE *fp; fp = fopen (filename, "r"); if (!fp) { fprintf (stderr, "Error: couldn't open \"%s\"!\n", filename); return 0; } //std::cout << "premem" << std::endl; /* reset model data */ memset (&mdl, 0, sizeof (struct obj_model_t)); //std::cout << "memorioainitializado" << std::endl; /* first pass: read model info */ if (!FirstPass (fp)) { fclose (fp); return 0; } rewind (fp); /* memory allocation */ if (!MallocModel ()) { fclose (fp); FreeModel (); return 0; } /* second pass: read model data */ if (!SecondPass (fp)) { fclose (fp); FreeModel (); return 0; } fclose (fp); return 1; }
VBitmapData* VQuantizer::Quantize( VBitmapData& source ) { VBitmapData* output; output=new VBitmapData(source.GetWidth(),source.GetHeight(),VBitmapData::VPixelFormat8bppIndexed); if ( !_singlePass ) FirstPass ( source) ; std::vector<VColor>* palette=GetPalette(); if(palette) { output->SetColorTable(*palette); delete palette; } SecondPass ( source , *output ); return output; #if 0 int height = source.GetHeight() ; int width = source.GetWidth() ; Gdiplus::Rect bounds( 0 , 0 , width , height ) ; Gdiplus::RectF boundsf( 0.0 , 0.0 , 1.0*width ,1.0* height ) ; // First off take a 32bpp copy of the image Gdiplus::Bitmap* copy= new Gdiplus::Bitmap(width ,height,PixelFormat32bppARGB); // And construct an 8bpp version Gdiplus::Bitmap* output = new Gdiplus::Bitmap(width,height,PixelFormat8bppIndexed) ; // Now lock the bitmap into memory Gdiplus::Graphics g(copy ); g.SetPageUnit(Gdiplus::UnitPixel); g.DrawImage( &source ,boundsf) ; // Define a pointer to the bitmap data Gdiplus::BitmapData sourceData ; // Get the source image bits and lock into memory copy->LockBits ( &bounds , Gdiplus::ImageLockModeRead , PixelFormat32bppARGB ,&sourceData) ; // Call the FirstPass function if not a single pass algorithm. // For something like an octree quantizer, this will run through // all image pixels, build a data structure, and create a palette. if ( !_singlePass ) FirstPass ( sourceData , width , height ) ; // Then set the color palette on the output bitmap. I'm passing in the current palette // as there's no way to construct a new, empty palette. Gdiplus::ColorPalette* palette=GetPalette(); if(palette) { output->SetPalette(palette) ; free((void*)palette); } // Then call the second pass which actually does the conversion SecondPass ( sourceData , *output , width , height , bounds ) ; copy->UnlockBits ( &sourceData ) ; // Last but not least, return the output bitmap return output; #endif }