本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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]);
}
}
示例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);
}
}
示例6: Use
void Gizmo3D::Update(Vector<Node *> &editNodes)
{
editNodes_ = &editNodes;
Use();
Position();
}
示例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();
}
示例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;
}
示例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;
}
示例10: Start
TOD_Turn_Data::TOD_Turn_Data (void)
{
Start (0);
End (0);
Use (0);
Penalty (0);
TOD_List (0);
}
示例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();
}
示例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 );
}
示例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;
}
示例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);
}
示例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);
}