本文整理汇总了C++中texture::Sampler::release方法的典型用法代码示例。如果您正苦于以下问题:C++ Sampler::release方法的具体用法?C++ Sampler::release怎么用?C++ Sampler::release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类texture::Sampler
的用法示例。
在下文中一共展示了Sampler::release方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lua_TextureSampler_release
int lua_TextureSampler_release(lua_State* state)
{
// Get the number of parameters.
int paramCount = lua_gettop(state);
// Attempt to match the parameters to a valid binding.
switch (paramCount)
{
case 1:
{
if ((lua_type(state, 1) == LUA_TUSERDATA))
{
Texture::Sampler* instance = getInstance(state);
instance->release();
return 0;
}
lua_pushstring(state, "lua_TextureSampler_release - Failed to match the given parameters to a valid function signature.");
lua_error(state);
break;
}
default:
{
lua_pushstring(state, "Invalid number of parameters (expected 1).");
lua_error(state);
break;
}
}
return 0;
}
示例2: setNode
void Form::setNode(Node* node)
{
// If the user wants a custom node then we need to create a 3D quad
if (node && node != _node)
{
// Set this Form up to be 3D by initializing a quad.
float x2 = _bounds.width;
float y2 = _bounds.height;
float vertices[] =
{
0, y2, 0, 0, _v1,
0, 0, 0, 0, 0,
x2, y2, 0, _u2, _v1,
x2, 0, 0, _u2, 0
};
VertexFormat::Element elements[] =
{
VertexFormat::Element(VertexFormat::POSITION, 3),
VertexFormat::Element(VertexFormat::TEXCOORD0, 2)
};
Mesh* mesh = Mesh::createMesh(VertexFormat(elements, 2), 4, false);
GP_ASSERT(mesh);
mesh->setPrimitiveType(Mesh::TRIANGLE_STRIP);
mesh->setVertexData(vertices, 0, 4);
_nodeQuad = Model::create(mesh);
SAFE_RELEASE(mesh);
GP_ASSERT(_nodeQuad);
// Create the effect and material
Effect* effect = createEffect();
GP_ASSERT(effect);
_nodeMaterial = Material::create(effect);
GP_ASSERT(_nodeMaterial);
_nodeQuad->setMaterial(_nodeMaterial);
_nodeMaterial->release();
node->setModel(_nodeQuad);
_nodeQuad->release();
// Bind the WorldViewProjection matrix.
_nodeMaterial->setParameterAutoBinding("u_worldViewProjectionMatrix", RenderState::WORLD_VIEW_PROJECTION_MATRIX);
// Bind the texture from the framebuffer and set the texture to clamp
Texture::Sampler* sampler = Texture::Sampler::create(_frameBuffer->getRenderTarget()->getTexture());
GP_ASSERT(sampler);
sampler->setWrapMode(Texture::CLAMP, Texture::CLAMP);
_nodeMaterial->getParameter("u_texture")->setValue(sampler);
sampler->release();
RenderState::StateBlock* rsBlock = _nodeMaterial->getStateBlock();
rsBlock->setDepthWrite(true);
rsBlock->setBlend(true);
rsBlock->setBlendSrc(RenderState::BLEND_SRC_ALPHA);
rsBlock->setBlendDst(RenderState::BLEND_ONE_MINUS_SRC_ALPHA);
}
_node = node;
}