当前位置: 首页>>代码示例>>C++>>正文


C++ Use函数代码示例

本文整理汇总了C++中Use函数的典型用法代码示例。如果您正苦于以下问题:C++ Use函数的具体用法?C++ Use怎么用?C++ Use使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Use函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Place

  bool Place(Content<_T> content) {
     
    Sort();
    
    for( Coord::List::iterator itor = topLefts.begin(); itor != topLefts.end(); itor++ ) {
      
      content.coord = *itor;
      
      if( Fits( content ) ) {
	
	Use( content );
	topLefts.erase( itor );
	return true;
      }
    }
    
    // EXPERIMENTAL - TRY ROTATED?
    content.Rotate();
    for( Coord::List::iterator itor = topLefts.begin(); itor != topLefts.end(); itor++ ) {
      
      content.coord = *itor;
      
      if( Fits( content ) ) {
	
	Use( content );
	topLefts.erase( itor );
	return true;
      }
    }
    ////////////////////////////////
    
    
    return false;
  }
开发者ID:DanMillward,项目名称:halley,代码行数:34,代码来源:binpack2d.hpp

示例2: Use

void Level1Algo::reset()
{
    m_boardData.assign(m_boardData.size(), 0);
    m_thisUse.assign(m_thisUse.size(), Use());
    m_peerUse.assign(m_peerUse.size(), Use());

    m_deadWinSet.clear();
    m_peerDeadWinSet.clear();

    m_isFirst = true;
}
开发者ID:GHScan,项目名称:DailyProjects,代码行数:11,代码来源:Level1.cpp

示例3: make_scope

nResult n2dFontImpl::PrintFont(n2dGraphics2D* pGraphic, ncTStr str, nFloat x, nFloat y, nFloat scale, n2dTexture* pTexture)
{
	if (!m_pFTLib)
	{
		return NatErr_IllegalState;
	}

	nBool shouldEnd;
	auto pUsingProgram = m_pRenderer->GetShaderWrapper()->GetCurrentProgram();
	auto pFontProgram = m_pRenderer->GetShaderWrapper()->GetFontProgram();
	if (pGraphic->IsRendering())
	{
		shouldEnd = false;
		pGraphic->Flush();
	}
	else
	{
		shouldEnd = true;
		pGraphic->Begin();
	}
	m_pRenderer->PushMVPMat();
	m_pRenderer->InitMVPMat();
	auto window = m_pRenderer->GetEngine()->GetWindow();
	m_pRenderer->SubmitProjMat(natTransform::ortho(0.0f, static_cast<nFloat>(window->GetWidth()), 0.0f, static_cast<nFloat>(window->GetHeight())));
	auto scope = make_scope([shouldEnd, pGraphic, pUsingProgram, this]
	{
		if (shouldEnd)
		{
			pGraphic->End();
		}
		else
		{
			pGraphic->Flush();
		}

		m_pRenderer->PopMVPMat();
		pUsingProgram->Use();
	});

	pFontProgram->Use();
	GLint textureID = 0;
	pFontProgram->GetUniformReference(1)->SetValue(1, &textureID);
	textureID = 1;
	pFontProgram->GetUniformReference(2)->SetValue(1, &textureID);
	GLint useTexture = GL_TRUE;
	pFontProgram->GetUniformReference(3)->SetValue(1, &useTexture);

	glActiveTexture(GL_TEXTURE1);
	glBindTexture(GL_TEXTURE_2D, pTexture->GetTextureID());

	return PrintFontImpl(pGraphic, str, x, y, scale);
}
开发者ID:akemimadoka,项目名称:Natsu2D,代码行数:52,代码来源:n2dFontImpl.cpp

示例4: Use

 void Program::Uniforms(const std::unordered_map<std::string, const glm::mat4 *> &&uniforms) {
   Use();
   for (auto &uniform : uniforms) {
     glUniformMatrix4fv(GetUniformLocation(uniform.first),
                        1, false, &uniform.second->operator[](0)[0]);
   }
 }
开发者ID:robertsdionne,项目名称:textengine,代码行数:7,代码来源:program.cpp

示例5: glClear

void OGLSpotLight::Render(double time)
{
    glClear(GL_DEPTH_BUFFER_BIT);
    glm::vec3 bgColor(0.2f);
    glClearBufferfv(GL_COLOR, 0, &bgColor[0]);

    camera.Update();
    light.position = camera.GetPosition();
    light.direction = camera.GetForwardDirection();

    // Render container
    auto programMesh = programs[0];
    programMesh->Use();

    SendLightUniform(programMesh.get());

    glm::mat4 model = glm::mat4(1);
    for (size_t i = 0; i < 10; i++) {
        float sign = (i % 2) * 2 - 1.0f;
        model = glm::mat4(1);
        model = glm::rotate(model, i * 0.2f * glm::two_pi<float>(), glm::vec3(0, 1, 0)) *
                glm::translate(model, glm::vec3(20, 0, 20));

        model = glm::scale(glm::rotate(glm::translate(glm::mat4(1), cubePositions[i]), glm::radians(sign * 30.0f), cubePositions[i]), glm::vec3(10));
        SendMatricesUniform(programMesh.get(), model);
        vaos[0]->BindVAO();
        vbos[0]->BindVBO();
        textures[0]->BindTexture(GL_TEXTURE0);
        textures[1]->BindTexture(GL_TEXTURE3);
        glUniform1f(programMesh->GetUniform("material.shininess"), 32.0f);
        glDrawArrays(GL_TRIANGLES, 0, 36);
    }
}
开发者ID:Coeurou,项目名称:OGL_Perigrination,代码行数:33,代码来源:OGLSpotLight.cpp

示例6: Use

void Gizmo3D::Update(Vector<Node *> &editNodes)
{
    editNodes_ = &editNodes;

    Use();
    Position();
}
开发者ID:WorldofOpenDev,项目名称:AtomicGameEngine,代码行数:7,代码来源:Gizmo3D.cpp

示例7: GetMetrics

void LabelElement::Render() {
	auto m = GetMetrics();
	auto gui = GUI::Get();
	auto textProgram = ShaderRegistry::GetProgram("text");

	textProgram->Use();
	gui->camera->SetUniforms(textProgram.get());
	
	glUniform4f(textProgram->GetUniform("color"), 1,1,1, 1);

	auto size = m->topRight - m->bottomLeft;

	auto scalexy = size/textMesh->size;
	auto scale = std::min(scalexy.x, scalexy.y);
	auto tmbl = m->bottomLeft + vec2{0, textMesh->size.y * scalexy.y};

	Debug::PointUI(m->topRight);
	Debug::PointUI(m->bottomLeft);
	Debug::PointUI(m->bottomLeft + vec2{0, textMesh->size.y * scale}, vec3{1,1,0});

	Debug::PointUI(tmbl, vec3{1,0,0});
	Debug::PointUI(tmbl + textMesh->size * vec2{1,-1} * scale, vec3{0,1,0});
	Debug::PointUI(tmbl + textMesh->size * vec2{1,-1} * scale * .5f, vec3{0,0,1});

	textMesh->modelMatrix = 
		glm::translate(vec3{tmbl, 0}) *
		glm::scale(vec3{scale});

	textMesh->Render();
}
开发者ID:manpat,项目名称:vox,代码行数:30,代码来源:label.cpp

示例8: Place

        bool Place(Content<_T> content)
        {
            Sort();

            for( Coord::List::iterator itor = topLefts.begin(); itor != topLefts.end(); itor++ )
            {
                content.coord = *itor;

                if( Fits( content ) )
                {
                    Use( content );
                    topLefts.erase( itor );
                    return true;
                }
            }

            return false; // yvt: BitmapAtlasGenerator doesn't support rotated contents.

            // EXPERIMENTAL - TRY ROTATED?
        //    content.Rotate();
        //    for(Coord::List::iterator itor = topLefts.begin(); itor != topLefts.end(); itor++)
        //    {
        //        content.coord = *itor;

        //        if( Fits( content ) )
        //        {
        //            Use( content );
        //            topLefts.erase( itor );
        //            return true;
        //        }
        //    }
        //    ////////////////////////////////

        //    return false;
        }
开发者ID:PlutoniumHeart,项目名称:openspades,代码行数:35,代码来源:binpack2d.hpp

示例9: main

int main(int argc, char *argv[])
{
    int sock, x = 0;
    char *Path = argv[1], *Pro_Sea = argv[2], *Host = argv[3];

    puts("[+] NsT-phpBBDoS v0.1 by HaCkZaTaN");
    puts("[+] NeoSecurityTeam");
    puts("[+] Dos has begun....[+]\n");
    fflush(stdout);

    if(argc != 4) Use(argv[0]);

    while(1)
    {
           sock = Connection(Host,80);
           Write_In(sock, Path, Pro_Sea, Host, x);
           #ifndef WIN32
           shutdown(sock, SHUT_WR);
           close(sock);
           #else
           closesocket(sock);
           WSACleanup();
           #endif
           Pro_Sea = argv[2];
           x++;
    }
    //I don't think that it will get here =) 

    return 0;
}
开发者ID:0x24bin,项目名称:exploit-database,代码行数:30,代码来源:1064.c

示例10: Start

TOD_Turn_Data::TOD_Turn_Data (void)
{
	Start (0);
	End (0);
	Use (0);
	Penalty (0);
	TOD_List (0);
}
开发者ID:kravitz,项目名称:transims4,代码行数:8,代码来源:TOD_Turn_Data.cpp

示例11: glColor4f

void Texture::OnDraw(int x, int y) const
{
	glColor4f(1, 1, 1, 1); // Should be black?

	auto shader = _vid.GetShader(0);
	shader->Use();

	// Update parameters
	glUniform1i(shader->grad_shift_id, 0);
	float recols[] = {
		0.0, 1.0, 0.0,
		1.0, 0.0, 0.0,
	};
	glUniform3fv(shader->recolour, 2, recols);

	int *pos_id = &shader->pos_id;
	int *texcoord_id = &shader->tex_coord;

	// If there's no mask, maskid is bound to the 0 texture, so ends up being a no-op.
	glActiveTexture(GL_TEXTURE1);
	glBindTexture(GL_TEXTURE_2D, this->maskid);

	glActiveTexture(GL_TEXTURE0);
	glBindTexture(GL_TEXTURE_2D, this->texid);

	float left = x;
	float right = x + this->width;
	float top = y;
	float bottom = y + this->height;

	float vertices[] = {
	        left,  top,    0, 0, // top-left
	        right, top,    1, 0, // top-right
	        left,  bottom, 0, 1, // bottom-left
	        right, top,    1, 0, // top-right
	        left,  bottom, 0, 1, // bottom-left
	        right, bottom, 1, 1, // bottom-right
	};

	glBindBuffer(GL_ARRAY_BUFFER, this->vbo);
	glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_DYNAMIC_DRAW);
	glEnableVertexAttribArray(*pos_id);
	glEnableVertexAttribArray(*texcoord_id);
	glVertexAttribPointer(*pos_id,      2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void *)(0));
	glVertexAttribPointer(*texcoord_id, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void *)(2 * sizeof(float)));

	glDrawArrays(GL_TRIANGLES, 0, 6); // 2 triangles

	/* Clean up */
	glDisableVertexAttribArray(*pos_id);
	glDisableVertexAttribArray(*texcoord_id);
	glBindBuffer(GL_ARRAY_BUFFER, 0);
	shader->StopUsing();
}
开发者ID:LordAro,项目名称:gltest,代码行数:54,代码来源:texture.cpp

示例12: Spawn

void CTriggerHurt :: Spawn( void )
{
	pev->solid = SOLID_NOT;
	pev->movetype = MOVETYPE_NONE;
	UTIL_SetModel(ENT(pev), pev->model);
	UTIL_SetOrigin( this, pev->origin );
	SetBits( pev->effects, EF_NODRAW );
	m_iState = STATE_OFF;
	                            
	if (!FBitSet(pev->spawnflags, 2 )) Use( this, this, USE_ON, 0 );
}
开发者ID:a1batross,项目名称:Xash3D_ancient,代码行数:11,代码来源:basetrigger.cpp

示例13: AddProgram

bool OGLSpotLight::AddProgram(const std::string & vsFilename, const std::string & fsFilename)
{
    bool res = true;
    auto program = std::make_shared<gs::Program>();
    res &= program->CreateShader(GL_VERTEX_SHADER, vsFilename);
    res &= program->CreateShader(GL_FRAGMENT_SHADER, fsFilename);

    res &= program->Link();
    program->Use();
    programs.push_back(program);
    return res;
}
开发者ID:Coeurou,项目名称:OGL_Perigrination,代码行数:12,代码来源:OGLSpotLight.cpp

示例14: Class_Index

Link_Data::Link_Data (int link) : Class_Index (link)
{
	Anode (0);
	Bnode (0);
	Length (0);
	Aoffset (0);
	Boffset (0);
	Use (0);
	Type (0);
	AB_Dir (0);
	BA_Dir (0);
	Shape (0);
}
开发者ID:kravitz,项目名称:transims4,代码行数:13,代码来源:Link_Data.cpp

示例15: Class_Index

Link_Detail_Data::Link_Detail_Data (int link_dir) : Class_Index (link_dir)
{
	Type (0);
	Control (0);
	Left (0);
	Left_Thru (0);
	Thru (0);
	Right_Thru (0);
	Right (0);
	Use (0);
	Lanes (0);
	Period (NULL);
}
开发者ID:kravitz,项目名称:transims4,代码行数:13,代码来源:Link_Detail_Data.cpp


注:本文中的Use函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。