コード例 #1
0
ファイル: ERNRenderer.cpp プロジェクト: rustanitu/TFG
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;
}
コード例 #2
0
/////////////////////////////////////////////////////////////////////////////////////
//  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();
}
コード例 #3
0
ファイル: Project_Main.c プロジェクト: AdamDe/Programming
/*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;
}
コード例 #4
0
ファイル: Material.cpp プロジェクト: ncarnahan/Canti
 void Material::Pass(int pass)
 {
     if (pass == 0)
     {
         FirstPass(blendType);
     }
     else
     {
         SecondPass(blendType);
     }
 }
コード例 #5
0
void CDeferredShadingSceneRendererCommand::ExecuteDeferredShadingUsingLightVolumes(CRenderManager &RenderManager)
{
	CLightManager* l_LightManager = CEngine::GetSingleton().GetLightManager();
	std::vector<CLight*> l_Lights = l_LightManager->GetResourcesVector();
	size_t l_Size = l_Lights.size();

	int l_Width = RenderManager.GetContextManager()->GetFrameBufferWidth();
	int l_Height = RenderManager.GetContextManager()->GetFrameBufferHeight();

	ActivateTextures();

	for (size_t i = 0; i<l_Size; ++i)
	{
		/*Only 1 light*/
		if (l_Lights[i]->GetActive())
		{
			CEngine::GetSingleton().GetEffectManager()->SetLightConstants(0, l_Lights[i]);
			m_RenderableObjectTechnique->GetEffectTechnique()->SetConstantBuffer(1, &CEffectManager::m_LightEffectParameters);

			if (l_Lights[i]->GetType() != CLight::OMNI) //
			{
				RenderManager.GetContextManager()->SetRasterizerState(CContextManager::RS_SOLID);
				RenderManager.DrawScreenQuad(m_RenderableObjectTechnique->GetEffectTechnique(), NULL, 0, 0, 1.0f, 1.0f, CColor(v4fZERO));
			}
			else
			{
				float l_LightRadius = l_Lights[i]->GetEndRangeAttenuation();
				Mat44f l_Scale;
				l_Scale.SetFromScale(l_LightRadius, l_LightRadius, l_LightRadius);

				Mat44f l_LightTransform = l_Lights[i]->GetTransform();

				RenderManager.GetContextManager()->SetWorldMatrix(l_Scale*l_LightTransform);

				FirstPast(RenderManager);
				CRenderableObjectTechnique* l_Technique  = CEngine::GetSingleton().GetRenderableObjectTechniqueManager()->GetResource("deferred_shading_omnilight_sphere_renderable_object_technique");
				m_SphereFirstPass->Render(&RenderManager, l_Technique);
				SecondPass(RenderManager);
				m_SphereFirstPass->Render(&RenderManager);
			}
		}
	}

	CEngine::GetSingleton().GetRenderManager()->GetContextManager()->DisableAlphaBlendState();
}
コード例 #6
0
// The Union-Find labeling algoritm. Works in two passes and uses a Union-Find
// data strucure to resolve the equivalences between labels. 
void FindConnectedComponents(const std::vector<uint>& img, std::vector<uint>& res, uint xLen, uint yLen, uint connectivity) {
    uint currLabel = 0;
    std::map<uint, node *> labToNode;
    // first pass: assign labels to different zones
    res[0] = currLabel;
    AddLabel(currLabel, labToNode);
    if (connectivity == 4) {
        FirstPass<4>(img, res, xLen, yLen, labToNode, currLabel);
    }
    else if (connectivity == 8) {
        FirstPass<8>(img, res, xLen, yLen, labToNode, currLabel);
    }
    else {
        std::cout << "This is not a valid connectivity! Exiting ..." << std::endl;
        exit(1);
    }
    // second pass: merge classes if necessary
    SecondPass(labToNode, res, xLen, yLen, currLabel);
}
コード例 #7
0
ファイル: obj.c プロジェクト: echo0101/Island
/**
 * 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;
}
コード例 #8
0
/**
 * 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;
}
コード例 #9
0
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
}