本文整理汇总了C++中Pipeline类的典型用法代码示例。如果您正苦于以下问题:C++ Pipeline类的具体用法?C++ Pipeline怎么用?C++ Pipeline使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Pipeline类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RenderSceneCB
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: initWidget
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: RenderPhase
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: TEST
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: TEST
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: RenderSceneCB
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();
}
示例7: RenderShadowVolIntoStencil
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);
}
示例8: render
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;
}
示例9: VideoSource
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_);
}
示例10: strlen
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);
}
示例11: PipelineEditor
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();
}
示例12:
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);
}
示例13: glClear
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();
}
}
示例14: UpdatePipelineCombo
void ELPipelineBuilder::UpdatePipelineCombo()
{
for (int i=0; i<Pipeline::allPipelines.size(); i++)
{
Pipeline *p = Pipeline::allPipelines[i];
pipelineChooser->setItemText(i, p->GetName().c_str());
}
}
示例15: build_params
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);
}