本文整理汇总了C++中FrameBufferObject::texture_slot方法的典型用法代码示例。如果您正苦于以下问题:C++ FrameBufferObject::texture_slot方法的具体用法?C++ FrameBufferObject::texture_slot怎么用?C++ FrameBufferObject::texture_slot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrameBufferObject
的用法示例。
在下文中一共展示了FrameBufferObject::texture_slot方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawTextureShader
void DrawShader::drawTextureShader(bool isReflection, Shader& shader, const std::vector<Drawable>& drawables,
const glm::mat4& viewMatrix, const glm::vec3& sunDir, float sunIntensity,
int lightning, const FrameBufferObject& reflection_fbo) {
shader.sendUniform(Uniform::PROJECTION, uniforms, gProjectionMatrix);
shader.sendUniform(Uniform::VIEW, uniforms, viewMatrix);
shader.sendUniform(Uniform::LIGHTNING, uniforms, lightning);
SendSun(shader, uniforms, sunIntensity, sunDir);
for (auto& drawable : drawables) {
if (drawable.draw_template.shader_type == ShaderType::TEXTURE ||
drawable.draw_template.shader_type == ShaderType::DEFERRED) {
{
// Per-Drawable Texture Shader Setup
//SendHeightMap(shader, drawable);
SendBones(shader, drawable);
SendTexture(shader, drawable);
if (!isReflection && drawable.draw_template.effects.count(EffectType::IS_WATER)) {
shader.sendUniform(Uniform::IS_WATER, uniforms, 1);
shader.sendUniform(Uniform::REFLECTION_TEXTURE, uniforms, reflection_fbo.texture_slot());
reflection_fbo.texture().enable(texture_cache_);
}
else
shader.sendUniform(Uniform::IS_WATER, uniforms, 0);
drawable.draw_template.material.sendMaterial(shader, uniforms);
}
if (!drawable.draw_template.effects.count(EffectType::IS_WATER) || !isReflection)
drawModelTransforms(shader, drawable, viewMatrix, true, uniforms);
}
}
}
示例2: SendShadow
void DrawShader::SendShadow(Shader& shader, const UniformLocationMap& uniforms,
const FrameBufferObject& shadow_map_fbo_,
const glm::vec3& deerPos, const glm::vec3& sunDir) {
shadow_map_fbo_.texture().enable(texture_cache_);
shader.sendUniform(Uniform::HAS_SHADOWS, uniforms, 1);
shader.sendUniform(Uniform::SHADOW_MAP_TEXTURE, uniforms, shadow_map_fbo_.texture_slot());
SendInverseShadow(shader, uniforms, sunDir, deerPos);
}
示例3: Draw
//.........这里部分代码省略.........
glFrontFace(GL_CCW);
}
break;
case ShaderType::TEXTURE:
if (!useTextureShader) break;
if(printCurrentShaderName)
printf("Texture\n");
glBindFramebuffer(GL_FRAMEBUFFER, 0);
{
const auto drawables = Drawable::fromCulledDrawables(culledDrawables, CullType::VIEW_CULLING);
shader.sendUniform(Uniform::USE_BLINN_PHONG, uniforms, useBlinnPhong);
SendShadow(shader, uniforms, shadow_map_fbo_, deerPos, sunDir);
SendScreenSize(shader, uniforms);
drawTextureShader(false, shader, drawables, viewMatrix, sunDir, sunIntensity,
lightning, reflection_fbo);
}
break;
case ShaderType::SKYBOX:
if(printCurrentShaderName)
printf("Skybox\n");
shader.sendUniform(Uniform::PROJECTION, uniforms, gProjectionMatrix);
for (auto& drawable : culledDrawables) {
if (drawable.draw_template.shader_type == ShaderType::SKYBOX) {
/* doesn't use drawModelTransforms because no normals */
for(const auto& instance : drawable.draw_instances) {
shader.sendUniform(Uniform::TEXTURE, uniforms,
(*drawable.draw_template.texture).texture_slot());
(*drawable.draw_template.texture).enable(texture_cache_);
if (drawable.draw_template.effects.count(EffectType::IS_TITLE_SCREEN)) {
shader.sendUniform(Uniform::IS_TITLE_SCREEN, uniforms, 1);
curView = glm::lookAt( glm::vec3(2.0f, 0.f,0.0f),glm::vec3(0.f, 0.f, 0.f),glm::vec3( 0.0f, 1.0f, 0.0f ) );
}
else {
shader.sendUniform(Uniform::IS_TITLE_SCREEN, uniforms, 0);
curView = viewMatrix;
}
shader.sendUniform(Uniform::MODEL_VIEW, uniforms,
curView * instance.instance.model_transform);
shader.drawMesh(drawable.draw_template.mesh);
}
}
}
break;
case ShaderType::DEFERRED:
if (useTextureShader) break;
if(printCurrentShaderName)
printf("Deferred\n");
for (size_t i = 0; i < LAST_DEFERRED; ++i) {
DeferredType deferred_type = static_cast<DeferredType>(i);
switch (deferred_type) {
case DEFERRED_DIFFUSE:
deferred_diffuse_fbo_.bind();
break;
case DEFERRED_POSITION:
deferred_position_fbo_.bind();
break;