예제 #1
0
파일: Source.cpp 프로젝트: onerain88/OGLDev
void RenderSceneCB()
{
	glClear(GL_COLOR_BUFFER_BIT);

	glUseProgram(shaderProgram);

	static float scale = 0.0f;
	scale += 0.1f;

	Pipeline p;
	
	p.WorldPos(0.0f, 0.0f, 3.0f);
	p.Rotate(0.0f, scale, 0.0f);
	p.SetCamera(*pGameCamera);
	p.SetPerspectiveProj(ppi);

	glUniformMatrix4fv(glGetUniformLocation(shaderProgram, "_World"), 1, GL_TRUE, (const GLfloat*)p.GetWVPTrans());

	glBindBuffer(GL_ARRAY_BUFFER, VBO);
	glEnableVertexAttribArray(0);
	glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IBO);
	glDrawElements(GL_TRIANGLES, 12, GL_UNSIGNED_INT, 0);
	glDisableVertexAttribArray(0);

	glutSwapBuffers();
}
예제 #2
0
void GlyphCustom::initWidget() {
	PipelineManager* pm = m_mainWnd->getPipelineManager();
	Pipeline* pl = pm->getPipeline(m_pipelineID);

	// Get the instance of OkcVisualMap
	VisualMap* visMap = pl->getVisualMap();
	assert( typeid(*visMap)==typeid(OkcVisualMap) );
	OkcVisualMap* okcVisMap = dynamic_cast<OkcVisualMap*>(visMap);

	// Get the instance of GlyphPlace
	GlyphPlace* place = okcVisMap->getGlyphPlace();
	XmdvTool::GLYPHPLACE_MODE mode = place->getGlyphPlaceMode();

	// Check one radio button about sorting mode in terms of
	// the OkcVisualMap configuration
	switch (mode) {
	case XmdvTool::GLYPHPLACE_ORIGINAL :
		ui.radioButton_orig->setChecked(true);
		changeToOriginal();
		break;
	case XmdvTool::GLYPHPLACE_ORDERED :
		ui.radioButton_order->setChecked(true);
		changeToOrdered();
		break;
	case XmdvTool::GLYPHPLACE_DATA_DRIVEN	:
		ui.radioButton_datadriven->setChecked(true);
		changeToDatadriven();
		break;
	case XmdvTool::GLYPHPLACE_DERIVED :
		ui.radioButton_derived->setChecked(true);
		changeToDerived();
		break;
	}

}
예제 #3
0
파일: main.cpp 프로젝트: andriyut/ogldev
 void RenderPhase()
 {
     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
     
     Pipeline p;
     p.Scale(0.1f, 0.1f, 0.1f);
     p.Rotate(0.0f, 90.0f, 0.0f);
     p.SetCamera(m_pGameCamera->GetPos(), m_pGameCamera->GetTarget(), m_pGameCamera->GetUp());
     p.SetPerspectiveProj(m_persProjInfo);
     
     // If the left mouse button is clicked check if it hit a triangle
     // and color it red
     if (m_leftMouseButton.IsPressed) {
         PickingTexture::PixelInfo Pixel = m_pickingTexture.ReadPixel(m_leftMouseButton.x, WINDOW_HEIGHT - m_leftMouseButton.y - 1);
         
         if (Pixel.PrimID != 0) {                
             m_simpleColorEffect.Enable();
             p.WorldPos(m_worldPos[Pixel.ObjectID]);
             m_simpleColorEffect.SetWVP(p.GetWVPTrans());
             // Must compensate for the decrement in the FS!
             m_pMesh->Render(Pixel.DrawID, Pixel.PrimID - 1); 
         }
     }
     
     // render the objects as usual
     m_lightingEffect.Enable();
     m_lightingEffect.SetEyeWorldPos(m_pGameCamera->GetPos());
     
     for (unsigned int i = 0 ; i < ARRAY_SIZE_IN_ELEMENTS(m_worldPos) ; i++) {
         p.WorldPos(m_worldPos[i]);
         m_lightingEffect.SetWVP(p.GetWVPTrans());
         m_lightingEffect.SetWorldMatrix(p.GetWorldTrans());                
         m_pMesh->Render(NULL);
     }        
 }
예제 #4
0
파일: CodecTest.cpp 프로젝트: orian/wangle
TEST(FixedLengthFrameDecoder, FailWhenLengthFieldEndOffset) {
  Pipeline<IOBufQueue&, std::unique_ptr<IOBuf>> pipeline;
  int called = 0;

  pipeline
    .addBack(FixedLengthFrameDecoder(10))
    .addBack(FrameTester([&](std::unique_ptr<IOBuf> buf) {
        auto sz = buf->computeChainDataLength();
        called++;
        EXPECT_EQ(sz, 10);
      }))
    .finalize();

  auto buf3 = IOBuf::create(3);
  buf3->append(3);
  auto buf11 = IOBuf::create(11);
  buf11->append(11);
  auto buf16 = IOBuf::create(16);
  buf16->append(16);

  IOBufQueue q(IOBufQueue::cacheChainLength());

  q.append(std::move(buf3));
  pipeline.read(q);
  EXPECT_EQ(called, 0);

  q.append(std::move(buf11));
  pipeline.read(q);
  EXPECT_EQ(called, 1);

  q.append(std::move(buf16));
  pipeline.read(q);
  EXPECT_EQ(called, 3);
}
예제 #5
0
파일: CodecTest.cpp 프로젝트: JadeRay/folly
TEST(LengthFieldFrameDecoder, NoStrip) {
  Pipeline<IOBufQueue&, std::unique_ptr<IOBuf>> pipeline;
  int called = 0;

  pipeline
    .addBack(LengthFieldBasedFrameDecoder(2, 10, 0, 0, 0))
    .addBack(FrameTester([&](std::unique_ptr<IOBuf> buf) {
        auto sz = buf->computeChainDataLength();
        called++;
        EXPECT_EQ(sz, 3);
      }))
    .finalize();

  auto bufFrame = IOBuf::create(2);
  bufFrame->append(2);
  RWPrivateCursor c(bufFrame.get());
  c.writeBE((uint16_t)1);
  auto bufData = IOBuf::create(1);
  bufData->append(1);

  IOBufQueue q(IOBufQueue::cacheChainLength());

  q.append(std::move(bufFrame));
  pipeline.read(q);
  EXPECT_EQ(called, 0);

  q.append(std::move(bufData));
  pipeline.read(q);
  EXPECT_EQ(called, 1);
}
예제 #6
0
파일: CodecTest.cpp 프로젝트: orian/wangle
TEST(LengthFieldFrameDecoder, FailTestLengthFieldInitialBytes) {
  Pipeline<IOBufQueue&, std::unique_ptr<IOBuf>> pipeline;
  int called = 0;

  pipeline
    .addBack(LengthFieldBasedFrameDecoder(4, 10, 0, 0, 10))
    .addBack(FrameTester([&](std::unique_ptr<IOBuf> buf) {
        ASSERT_EQ(nullptr, buf);
        called++;
      }))
    .finalize();

  auto bufFrame = IOBuf::create(16);
  bufFrame->append(16);
  RWPrivateCursor c(bufFrame.get());
  c.writeBE((uint32_t)4); // frame size
  c.write((uint32_t)0); // nothing
  c.write((uint32_t)0); // nothing
  c.write((uint32_t)0); // nothing

  IOBufQueue q(IOBufQueue::cacheChainLength());

  q.append(std::move(bufFrame));
  pipeline.read(q);
  EXPECT_EQ(called, 1);
}
예제 #7
0
파일: main.cpp 프로젝트: Eizen/ogldev
static void RenderSceneCB()
{
    glClear(GL_COLOR_BUFFER_BIT);

    static float Scale = 0.0f;

    Scale += 0.001f;

    Pipeline p;
    p.Scale(sinf(Scale * 0.1f), sinf(Scale * 0.1f), sinf(Scale * 0.1f));
    p.WorldPos(sinf(Scale), 0.0f, 0.0f);
    p.Rotate(sinf(Scale) * 90.0f, sinf(Scale) * 90.0f, sinf(Scale) * 90.0f);

    glUniformMatrix4fv(gWorldLocation, 1, GL_TRUE, (const GLfloat*)p.GetTrans());

    glEnableVertexAttribArray(0);
    glBindBuffer(GL_ARRAY_BUFFER, VBO);
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IBO);

    glDrawElements(GL_TRIANGLES, 12, GL_UNSIGNED_INT, 0);

    glDisableVertexAttribArray(0);

    glutSwapBuffers();
}
예제 #8
0
    void RenderShadowVolIntoStencil()
    {
        glDepthMask(GL_FALSE);
        glEnable(GL_DEPTH_CLAMP);        
        glDisable(GL_CULL_FACE);
                    
		// We need the stencil test to be enabled but we want it
		// to succeed always. Only the depth test matters.
		glStencilFunc(GL_ALWAYS, 0, 0xff);

        glStencilOpSeparate(GL_BACK, GL_KEEP, GL_INCR_WRAP, GL_KEEP);
        glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_DECR_WRAP, GL_KEEP);       
		        
        m_ShadowVolTech.Enable();

        m_ShadowVolTech.SetLightPos(m_pointLight.Position);
             
        // Render the occluder
        Pipeline p;
        p.SetCamera(m_pGameCamera->GetPos(), m_pGameCamera->GetTarget(), m_pGameCamera->GetUp());        
        p.SetPerspectiveProj(m_persProjInfo);                       
        m_boxOrientation.m_rotation = Vector3f(0, m_scale, 0);
        p.Orient(m_boxOrientation);
        m_ShadowVolTech.SetWVP(p.GetWVPTrans());        
        m_box.Render();        
        
        // Restore local stuff
        glDisable(GL_DEPTH_CLAMP);
        glEnable(GL_CULL_FACE);                  
    }
예제 #9
0
void SmokeEffect::render(Pipeline& p, Renderer* r)
{
	p.pushMatrix();

	p.translate(m_position);
	p.addMatrix(m_rotation);
	p.scale(m_scale);


	r->setUniLocs(p);

	glBindBuffer(GL_ARRAY_BUFFER, m_particleBuffer[m_currTFB]);

//	glEnableVertexAttribArray(0);

	glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(SmokeParticle), (const GLvoid*)4);  // position

	glDrawTransformFeedback(GL_POINTS, m_transformFeedback[m_currTFB]);
	// glDrawArrays(GL_POINTS, 0, MAX_PARTICLES);
//	glDisableVertexAttribArray(0);

	p.popMatrix();

	m_currVB = m_currTFB;
	m_currTFB = (m_currTFB + 1) & 0x1;

}
예제 #10
0
VideoV4lSource::VideoV4lSource(const Pipeline &pipeline,
        const VideoSourceConfig &config) :
    VideoSource(config), expectedStandard_("NTSC"), actualStandard_("")
{
    source_ = pipeline.makeElement(config_.source(), NULL);
    // set a v4l2src if given to config as an arg, otherwise use default
    if (config_.hasDeviceName() && config_.deviceExists())
        g_object_set(G_OBJECT(source_), "device", config_.deviceName(), NULL);

    if (!v4l2util::checkStandard(expectedStandard_, actualStandard_, deviceStr()))
        if (not actualStandard_.empty())
        LOG_WARNING("V4l2 device " << deviceStr() << " is not set to expected standard "
                << expectedStandard_ << ", it is " << actualStandard_);

    LOG_DEBUG("v4l width is " << v4l2util::captureWidth(deviceStr()));
    LOG_DEBUG("v4l height is " << v4l2util::captureHeight(deviceStr()));

    if (willModifyCaptureResolution())
    {
        LOG_INFO("Changing v4l resolution to " <<
                config_.captureWidth() << "x" << config_.captureHeight());
        v4l2util::setFormatVideo(deviceStr(), config_.captureWidth(), config_.captureHeight());
    }

    capsFilter_ = pipeline.makeElement("capsfilter", NULL);
    setCapsFilter(srcCaps());
    gstlinkable::link(source_, capsFilter_);
}
예제 #11
0
void
Pipeline_Parse_Test::test_parse_exit_logical_not_FAILURE ()
{
  Pipeline p;

  uint errorc = 0;

  const char *pipelinev[] = {
    "filter1 | ! filter2"
  };

  const char *pipelinevp = 0;

  for (uint idx = 0; idx < 1; idx++)
    {
      try
        {
          // p._charc = strlen (pipelinev[idx]);
          // p.__parse (pipelinev[idx]);

          pipelinevp = pipelinev[idx];

          p._charc = strlen (pipelinevp);
          p._startp = pipelinevp;
          p._endp = pipelinevp + p._charc;

          p.parse (pipelinevp);
        }
      CATCH_ERROR_PCHAR;
    }

  CPPUNIT_ASSERT (errorc == 1);
}
예제 #12
0
파일: GUI.cpp 프로젝트: smistad/FAST
void GUI::editPipeline() {
    int selectedPipeline = mSelectPipeline->currentIndex();
    Pipeline pipeline = mPipelines.at(selectedPipeline);
    PipelineEditor* editor = new PipelineEditor(pipeline.getFilename());
    QObject::connect(editor, &PipelineEditor::saved, std::bind(&GUI::selectPipeline, this));
    editor->show();
}
예제 #13
0
void
Pipeline_Run_Test::test_str_assign_run_2 ()
{
  int status = EXIT_FAILURE;
  pid_t kpid = 0;

  size_t errorc = 0;

  Pipeline p = "ps | cat";

  // const std::vector<Filter *> *filters = p.filters ();

  try
    {
      status = p.execute ();
      CPPUNIT_ASSERT (status == EXIT_SUCCESS);

      status = p.assign ("ps | tee tee1.file tee2.file").execute ();
      CPPUNIT_ASSERT (status == EXIT_SUCCESS);

      p.assign ("ps | cat | cat | tee tee1.file tee2.file");
      // p.dump (filters->begin (), filters->end (), false);

      /// status = p.run (); // HANGS AFTER PS
      /// CPPUNIT_ASSERT (status == EXIT_SUCCESS);
    }
  CATCH_ERROR_PCHAR;

  CPPUNIT_ASSERT (errorc == 0);
}
예제 #14
0
void
Pipeline_Parse_Test::test_terminator_lookup ()
{
  Pipeline p = "";

  size_t charc = 0;
  size_t jdx = 0;

  const char *pipelinev[] = {
    "",
    "-",

    "|",
    "||",

    "-|-",
    "-|--|----",

    "-->|--",
    ">||>|-|>-|--"
  };

  const char *pipelinevp = 0;
  const char *endp = 0;

  size_t len[][10] = {
    { 0,        UNDEF, UNDEF, UNDEF, UNDEF,  UNDEF, UNDEF, UNDEF, UNDEF, UNDEF },
    { 1,        UNDEF, UNDEF, UNDEF, UNDEF,  UNDEF, UNDEF, UNDEF, UNDEF, UNDEF },

    { 1, 0,     UNDEF, UNDEF, UNDEF, UNDEF, UNDEF, UNDEF, UNDEF, UNDEF },
    { 1, 1, 0,  UNDEF, UNDEF, UNDEF, UNDEF, UNDEF, UNDEF, UNDEF },

    { 2, 1,     UNDEF, UNDEF, UNDEF, UNDEF, UNDEF, UNDEF, UNDEF, UNDEF },
    { 2, 3, 4,  UNDEF, UNDEF, UNDEF, UNDEF, UNDEF, UNDEF, UNDEF },

    { 6, UNDEF, UNDEF,  UNDEF, UNDEF, UNDEF, UNDEF, UNDEF, UNDEF, UNDEF },
    { 3, 4, 3, 2,  UNDEF, UNDEF, UNDEF, UNDEF, UNDEF, UNDEF }
  };

  for (uint idx = 0; idx < 8; idx++)
    {
      charc = 0;
      jdx = 0;

      pipelinevp = pipelinev[idx];
      p._readp = pipelinevp;
      endp = pipelinevp + strlen (pipelinevp);

      do
        {
          charc = p.terminator_lookup (endp);

          ASSERT_2IDX (charc == len[idx][jdx]);
          p._readp += charc;

          jdx++;
        }
      while (charc > 0);
    }
}
예제 #15
0
void
Pipeline_Run_Test::test_str_assign_run_1 ()
{
  int status = EXIT_FAILURE;

  pid_t kpid = 0;

  size_t errorc = 0;

  Pipeline p = "ps | sort --sort=random";

  try
    {
      status = p.execute ();
      CPPUNIT_ASSERT (status == EXIT_SUCCESS);

      p = "ps | sort --sort=random | less";
      status = p.execute ();
      CPPUNIT_ASSERT (status == EXIT_SUCCESS);

      p = "tar -cvf - /usr/local/tmp/file1 | ssh kare@ladybug dd of=tmp/store/ssh_pipeline_ut.tar";
      status = p.execute ();
      CPPUNIT_ASSERT (status == EXIT_SUCCESS);

      status = p.assign ("ls -l /home/kare/Kuvat").execute ();
      CPPUNIT_ASSERT (status == EXIT_SUCCESS);
    }
  CATCH_ERROR_PCHAR;

  CPPUNIT_ASSERT (errorc == 0);
}
예제 #16
0
파일: main.cpp 프로젝트: Eizen/ogldev
static void RenderSceneCB()
{
    glClear(GL_COLOR_BUFFER_BIT);

    static float Scale = 0.0f;

    Scale += 0.1f;

    Pipeline p;
    p.Rotate(0.0f, Scale, 0.0f);
    p.WorldPos(0.0f, 0.0f, 5.0f);
    p.SetPerspectiveProj(30.0f, WINDOW_WIDTH, WINDOW_HEIGHT, 1.0f, 100.0f);

    glUniformMatrix4fv(gWorldLocation, 1, GL_TRUE, (const GLfloat*)p.GetTrans());

    glEnableVertexAttribArray(0);
    glBindBuffer(GL_ARRAY_BUFFER, VBO);
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IBO);

    glDrawElements(GL_TRIANGLES, 12, GL_UNSIGNED_INT, 0);

    glDisableVertexAttribArray(0);

    glutSwapBuffers();
}
예제 #17
0
void Bone::Draw(){

	    glClear(GL_DEPTH_BUFFER_BIT);
		
		Pipeline p;
		p.Scale(1.0f,1.0f, 1.0f);
		p.WorldPos(x, y, 0.0f);
		p.Rotate(0.0f, 0.0f, a);

		
   glUniformMatrix4fv(Shader::gWorldLocation, 1, GL_TRUE, (const GLfloat*)p.GetTrans());


		glEnableVertexAttribArray(0);
		glBindBuffer(GL_ARRAY_BUFFER, VBO);
		glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);

		glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IBO);
		glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
		glDisableVertexAttribArray(0);

	for(std::vector<Bone*>::iterator it = child->begin(); it != child->end(); it++){
			(*it)->Draw();
	}
}
예제 #18
0
파일: CodecTest.cpp 프로젝트: orian/wangle
TEST(LineBasedFrameDecoder, CarriageNewLineOnly) {
  Pipeline<IOBufQueue&, std::unique_ptr<IOBuf>> pipeline;
  int called = 0;

  pipeline
    .addBack(LineBasedFrameDecoder(
              10, true, LineBasedFrameDecoder::TerminatorType::CARRIAGENEWLINE))
    .addBack(FrameTester([&](std::unique_ptr<IOBuf> buf) {
        auto sz = buf->computeChainDataLength();
        called++;
        EXPECT_EQ(sz, 1);
      }))
    .finalize();

  auto buf = IOBuf::create(3);
  buf->append(3);
  RWPrivateCursor c(buf.get());
  c.write<char>('\n');
  c.write<char>('\r');
  c.write<char>('\n');

  IOBufQueue q(IOBufQueue::cacheChainLength());

  q.append(std::move(buf));
  pipeline.read(q);
  EXPECT_EQ(called, 1);
}
예제 #19
0
void ELPipelineBuilder::UpdatePipelineCombo()
{
    for (int i=0; i<Pipeline::allPipelines.size(); i++)
    {
        Pipeline *p = Pipeline::allPipelines[i];
        pipelineChooser->setItemText(i, p->GetName().c_str());
    }
}
예제 #20
0
파일: Generator.cpp 프로젝트: cys4/Halide
Module GeneratorBase::build_module(const std::string &function_name,
                                   const LoweredFunc::LinkageType linkage_type) {
    build_params();
    Pipeline pipeline = build_pipeline();
    // Building the pipeline may mutate the params and imageparams.
    rebuild_params();
    return pipeline.compile_to_module(get_filter_arguments(), function_name, target, linkage_type);
}
예제 #21
0
파일: AppBase.cpp 프로젝트: kimkulling/osre
RenderBackend::Pipeline *AppBase::createDefaultPipeline() {
    Pipeline *pipeline = new Pipeline;
    PipelinePass *renderPass = new PipelinePass(RenderPassId, nullptr);
    CullState cullState( CullState::CullMode::CCW, CullState::CullFace::Front );
    renderPass->setCullState( cullState );
    pipeline->addPass(renderPass);
    
    return pipeline;
}
예제 #22
0
파일: example12.cpp 프로젝트: xsmart/tmf
int main(int argc, char** argv) {
  
  if (argc < 3) {
    cerr << "Usage: " << argv[0] << " <output video 1> <output video 2> " << endl;
    return -1;
  }
  
  string outputVideo1 = argv[1];
  string outputVideo2 = argv[2];
 
  Pipeline* pipe = Factory::createPipeline("DASH webcam stream - two output");
  
  Filter* reader = Factory::createFilter("video_reader", "reader");
  Filter* scaler1 = Factory::createFilter("image_scaler", "scaler1");
  Filter* scaler2 = Factory::createFilter("image_scaler", "scaler2");
  Filter* encoder1 = Factory::createFilter("video_encoder", "encoder1");
  Filter* encoder2 = Factory::createFilter("video_encoder", "encoder2");
  Filter* muxer1 = Factory::createFilter("video_muxer", "muxer1");
  Filter* muxer2 = Factory::createFilter("video_muxer", "muxer2");
  
  pipe->addFilters(reader, scaler1, scaler2, encoder1, encoder2, muxer1, muxer2, nullptr);
  
  pipe->connectFilters(reader, scaler1);
  pipe->connectFilters(scaler1, encoder1);
  pipe->connectFilters(encoder1, muxer1);
  pipe->connectFilters(reader, scaler2);
  pipe->connectFilters(scaler2, encoder2);
  pipe->connectFilters(encoder2, muxer2);
  
  reader->setProp("input_video", "/dev/video0");
  reader->setProp("video_format", "video4linux2");
  reader->setProp("input_format", "mjpeg");
  reader->setProp("framerate", "20");
  
  scaler1->setProp<int>("width", 640);
  scaler1->setProp<int>("height", 480);
  
  scaler2->setProp<int>("width", 320);
  scaler2->setProp<int>("height", 240);
  
  encoder1->setProp("bitrate", 400000);
  encoder1->setProp("framerate", 20);
  encoder1->setProp("output_video", outputVideo1);
 
  encoder2->setProp("bitrate", 400000);
  encoder2->setProp("framerate", 20);
  encoder2->setProp("output_video", outputVideo2);
  
  pipe->init();
  
  pipe->run();
  
  Factory::destroyPipeline(pipe);
  
  return 0;
}
예제 #23
0
TEST(PipelineTest, HandlerInPipelineTwice) {
  auto handler = std::make_shared<IntHandler>();
  EXPECT_CALL(*handler, attachPipeline(_)).Times(2);
  Pipeline<int, int> pipeline;
  pipeline.addBack(handler);
  pipeline.addBack(handler);
  pipeline.finalize();
  EXPECT_FALSE(handler->getContext());
  EXPECT_CALL(*handler, detachPipeline(_)).Times(2);
}
예제 #24
0
 void ShadowMapPass()
 {
     glCullFace(GL_FRONT);
     
     m_shadowMapEffect.Enable();
     
     PersProjInfo ProjInfo;
     ProjInfo.FOV = 90.0f;
     ProjInfo.Height = WINDOW_HEIGHT;
     ProjInfo.Width = WINDOW_WIDTH;
     ProjInfo.zNear = 1.0f;
     ProjInfo.zFar = 100.0f;  
     
     Pipeline p;
     p.SetPerspectiveProj(m_persProjInfo);                           
     
     glClearColor(FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX);
     
     for (uint i = 0 ; i < NUM_OF_LAYERS ; i++) {
         m_shadowMapFBO.BindForWriting(gCameraDirections[i].CubemapFace);
         glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);                       
                 
         p.SetCamera(m_pointLight.Position, gCameraDirections[i].Target, gCameraDirections[i].Up);
         
         p.Orient(m_mesh1Orientation);
         m_shadowMapEffect.SetWorld(p.GetWorldTrans());
         m_shadowMapEffect.SetWVP(p.GetWVPTrans());
         m_mesh.Render();
 
         p.Orient(m_mesh2Orientation);
         m_shadowMapEffect.SetWorld(p.GetWorldTrans());
         m_shadowMapEffect.SetWVP(p.GetWVPTrans());
         m_mesh.Render();
     }        
 }
예제 #25
0
    void RenderAmbientLight()
    {       
     	glEnable(GL_BLEND);
		glBlendEquation(GL_FUNC_ADD);
		glBlendFunc(GL_ONE, GL_ONE);
                                            
        m_LightingTech.Enable();

        m_pointLight.AmbientIntensity = 0.2f;
        m_pointLight.DiffuseIntensity = 0.0f;

        m_LightingTech.SetPointLights(1, &m_pointLight);
                             
        Pipeline p;
        p.SetPerspectiveProj(m_persProjInfo);
        p.SetCamera(m_pGameCamera->GetPos(), m_pGameCamera->GetTarget(), m_pGameCamera->GetUp());
        
        m_boxOrientation.m_rotation = Vector3f(0, m_scale, 0);
        p.Orient(m_boxOrientation);
        m_LightingTech.SetWVP(p.GetWVPTrans());
        m_LightingTech.SetWorldMatrix(p.GetWorldTrans());        
        m_box.Render();
       
        p.Orient(m_quadOrientation);
        m_LightingTech.SetWVP(p.GetWVPTrans());
        m_LightingTech.SetWorldMatrix(p.GetWorldTrans());
        m_pGroundTex->Bind(COLOR_TEXTURE_UNIT);        
        m_quad.Render();        
        
        glDisable(GL_BLEND);
    }        
예제 #26
0
    void RenderShadowedScene()
    {
        glDrawBuffer(GL_BACK);
                                          
        // Draw only if the corresponding stencil value is zero
        glStencilFunc(GL_EQUAL, 0x0, 0xFF);
        
        // prevent update to the stencil buffer
        glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
                
        m_LightingTech.Enable();
        
        m_pointLight.AmbientIntensity = 0.0f;
        m_pointLight.DiffuseIntensity = 0.8f;

        m_LightingTech.SetPointLights(1, &m_pointLight);
                                     
        Pipeline p;
        p.SetPerspectiveProj(m_persProjInfo);
        p.SetCamera(m_pGameCamera->GetPos(), m_pGameCamera->GetTarget(), m_pGameCamera->GetUp());        
        
        m_boxOrientation.m_rotation = Vector3f(0, m_scale, 0);
        p.Orient(m_boxOrientation);
        m_LightingTech.SetWVP(p.GetWVPTrans());
        m_LightingTech.SetWorldMatrix(p.GetWorldTrans());        
        m_box.Render();

        p.Orient(m_quadOrientation);
        m_LightingTech.SetWVP(p.GetWVPTrans());
        m_LightingTech.SetWorldMatrix(p.GetWorldTrans());        
        m_pGroundTex->Bind(COLOR_TEXTURE_UNIT);
        m_quad.Render();        
    }    
void
Simple_Command_Parse_Test::test_parse_numeric_arg_1 ()
{
  Pipeline p;

  size_t errorc = 0;

  Simple_Command *c[] = { 0, 0 };

  std::vector<Argument *> *va[] = { 0, 0 };
  Argument *a[] = { 0, 0, 0 };

  const char *pipelinev[] = {
    "filter1 15 5 | filter2 0700",
    "filter1 15 5 2>&1 | filter2 0700 &> filter2.out"
   };

  const char *pipelinevp = 0;

  for (uint idx = 0; idx < 2; idx++)
    {
      try
        {
          pipelinevp = pipelinev[idx];

          p._charc = strlen (pipelinevp);
          p._startp = pipelinevp;
          p._endp = pipelinevp + p._charc;

          p.parse (pipelinevp);

          c[0] = static_cast<Simple_Command *> (p._cmdv.at (0));
          c[1] = static_cast<Simple_Command *> (p._cmdv.at (1));

          va[0] = c[0]->arguments ();
          va[1] = c[1]->arguments ();

          ASSERT_IDX (va[0]->size() == 2);
          ASSERT_IDX (va[1]->size() == 1);

          a[0] = va[0]->at (0);
          a[1] = va[0]->at (1);
          a[2] = va[1]->at (0);

          ASSERT_IDX (Util::strEqu ( a[0]->value(), "15"));
          ASSERT_IDX (Util::strEqu ( a[1]->value(), "5"));
          ASSERT_IDX (Util::strEqu ( a[2]->value(), "0700"));

          p.clear ();
        }
      CATCH_ERROR_PCHAR;
    }
  ASSERT_NO_ERROR;
}
예제 #28
0
파일: Bus.cpp 프로젝트: mexxik/node-gst
void Bus::New(const FunctionCallbackInfo<Value>& info) {
    Bus *bus = ObjectWrap::Unwrap<Bus>(info.This());

    if (info.Length() > 0) {
        Pipeline *pipeline = ObjectWrap::Unwrap<Pipeline>(info[0]->ToObject());
        GstBus *gstBus = gst_pipeline_get_bus(GST_PIPELINE(pipeline->gstElement()));
        bus->gstBus(gstBus);
    }

    info.GetReturnValue().Set(info.This());
}
예제 #29
0
파일: Generator.cpp 프로젝트: DoDNet/Halide
std::vector<Argument> GeneratorBase::get_filter_output_types() {
    std::vector<Argument> output_types;
    Pipeline pipeline = build_pipeline();
    std::vector<Func> pipeline_results = pipeline.outputs();
    for (Func func : pipeline_results) {
        for (Halide::Type t : func.output_types()) {
            std::string name = "result_" + std::to_string(output_types.size());
            output_types.push_back(Halide::Argument(name, Halide::Argument::OutputBuffer, t, func.dimensions()));
        }
    }
    return output_types;
}
예제 #30
0
void OkcViewDisplay::drawData(){
	Pipeline* pl = getPipeline();
	switch (pl->getPipelineType()) {
	case XmdvTool::PLTYPE_FLATNORMAL :
	case XmdvTool::PLTYPE_DIMR :
		drawDataFlatNormal();
		break;
	case XmdvTool::PLTYPE_SBB :
		drawDataSBB();
		break;
	}
}