本文整理汇总了C++中vs_output类的典型用法代码示例。如果您正苦于以下问题:C++ vs_output类的具体用法?C++ vs_output怎么用?C++ vs_output使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了vs_output类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: shader_prog
void shader_prog(const vs_input& in, vs_output& out)
{
vec4 pos = in.attribute(0);
transform(out.position(), pos, wvp);
out.attribute(0) = in.attribute(0);//(vec4(1.0f, 1.0f, 1.0f, 1.0f) - in[0]);
out.attribute(1) = in.attribute(1);
}
开发者ID:xinchoubiology,项目名称:SalviaRenderer,代码行数:7,代码来源:AnisotropicFilter.cpp
示例2: shader_prog
void shader_prog(const vs_input& in, vs_output& out)
{
vec4 pos = in.attribute(0);
transform(out.position(), pos, wvp);
out.attribute(0) = in.attribute(1);
out.attribute(1) = in.attribute(2);
out.attribute(2) = light_pos - pos;
out.attribute(3) = eye_pos - pos;
}
开发者ID:EddyGun,项目名称:SalviaRenderer,代码行数:9,代码来源:Sponza.cpp
示例3: shader_prog
void shader_prog(const vs_input& in, vs_output& out)
{
vec4 pos = in.attribute(0);
vec4 pos_es, normal_es;
transform(pos_es, pos, wv);
transform33(normal_es, in.attribute(1), wv);
transform(out.position(), pos_es, proj);
out.attribute(0) = vec4(light_pos - pos_es.xyz(), 1);
out.attribute(1) = vec4(eye_pos - pos_es.xyz(), 1);
out.attribute(2) = normal_es;
}
开发者ID:EddyGun,项目名称:SalviaRenderer,代码行数:11,代码来源:ComplexMesh.cpp
示例4: shader_prog
void shader_prog(const vs_input& in, vs_output& out)
{
vec4 pos = in.attribute(0);
vec4 nor = in.attribute(1);
out.position() = out.attribute(0) = vec4(0.0f, 0.0f, 0.0f, 0.0f);
pos.w(1.0f);
nor.w(0.0f);
for(int i = 0; i < 4; ++i)
{
union {float f; int i;} f2i;
f2i.f = in.attribute(3)[i];
float w = in.attribute(4)[i];
int boneIndex = f2i.i;
if(boneIndex == -1){break;}
vec4 skin_pos;
vec4 skin_nor;
transform(skin_pos, invMatrices[boneIndex], pos);
transform(skin_pos, boneMatrices[boneIndex], skin_pos);
transform(skin_nor, invMatrices[boneIndex], nor);
transform(skin_nor, boneMatrices[boneIndex], skin_nor);
out.position() += (skin_pos*w);
out.attribute(0) += (skin_nor*w);
}
transform(out.position(), out.position(), wvp);
// out.attribute(0) = in.attribute(1);
out.attribute(1) = in.attribute(2);
out.attribute(2) = light_pos - pos;
out.attribute(3) = eye_pos - pos;
}
开发者ID:EddyGun,项目名称:SalviaRenderer,代码行数:33,代码来源:Morph.cpp
示例5: shader_prog
bool shader_prog(const vs_output& in, ps_output& out)
{
vec4 diff_color = vec4(1.0f, 1.0f, 1.0f, 1.0f); // diffuse;
vec3 norm( normalize3( in.attribute(0).xyz() ) );
vec3 light_dir( normalize3( in.attribute(1).xyz() ) );
vec3 eye_dir( normalize3( in.attribute(2).xyz() ) );
float illum_diffuse = clamp( dot_prod3( light_dir, norm ), 0.0f, 1.0f );
float illum_specular = clamp( dot_prod3( reflect3( light_dir, norm ), eye_dir ), 0.0f, 1.0f );
out.color[0] = ambient * 0.01f + diff_color * illum_diffuse + specular * illum_specular;
out.color[0] = diff_color * illum_diffuse;
// out.color[0] = ( vec4(norm, 1.0f) + vec4(1.0f, 1.0f, 1.0f, 1.0f) ) * 0.5f;
out.color[0][3] = 1.0f;
return true;
}
开发者ID:2007750219,项目名称:softart,代码行数:19,代码来源:AstroBoy.cpp
示例6: shader_prog
bool shader_prog(const vs_output& in, ps_output& out)
{
color_rgba32f tex_color(1.0f, 1.0f, 1.0f, 1.0f);
if( sampler_ )
{
tex_color = tex2d(*sampler_ , 0);
}
vec3 norm( normalize3( in.attribute(1).xyz() ) );
vec3 light_dir( normalize3( in.attribute(2).xyz() ) );
vec3 eye_dir( normalize3( in.attribute(3).xyz() ) );
float illum_diffuse = clamp( dot_prod3( light_dir, norm ), 0.0f, 1.0f );
float illum_specular = clamp( dot_prod3( reflect3( light_dir, norm ), eye_dir ), 0.0f, 1.0f );
vec4 illum = ambient + diffuse * illum_diffuse + specular * illum_specular;
out.color[0] = tex_color.get_vec4() * illum;
out.color[0][3] = 1.0f;
return true;
}
开发者ID:2007750219,项目名称:softart,代码行数:20,代码来源:ObjLoader.cpp
示例7: shader_prog
bool shader_prog(const vs_output& in, ps_output& out)
{
++count;
vec4 diff_color = vec4(1.0f, 1.0f, 1.0f, 1.0f); // diffuse;
if( sampler_ )
{
diff_color = tex2d(*sampler_, 0).get_vec4();
}
vec3 norm( normalize3( in.attribute(1).xyz() ) );
vec3 light_dir( normalize3( in.attribute(2).xyz() ) );
vec3 eye_dir( normalize3( in.attribute(3).xyz() ) );
float illum_diffuse = clamp( dot_prod3( light_dir, norm ), 0.0f, 1.0f );
out.color[0] = diff_color * illum_diffuse;
out.color[0][3] = 1.0f;
return true;
}
开发者ID:whztt07,项目名称:SALVIA,代码行数:21,代码来源:PartOfSponza.cpp
示例8: shader_prog
bool shader_prog(const vs_output& in, ps_output& out)
{
float height = in.attribute(0)[0];
vec4 colors[] =
{
vec4(0.0f, 0.0f, 0.5f, 1.0f),
vec4(0.7f, 0.6f, 0.0f, 1.0f),
vec4(0.45f, 0.38f, 0.26f, 1.0f),
vec4(0.0f, 0.7f, 0.8f, 1.0f),
vec4(0.9f, 0.9f, 1.0f, 1.0f),
vec4(0.9f, 0.9f, 1.0f, 1.0f) // sentinel
};
float boundary_points[] = {0.0f, 0.62f, 0.75f, 0.88f, 1.0f, 1.0f};
int lower_bound = -1;
for(int i = 0; i < 5; ++i)
{
if( height < boundary_points[i] ){
break;
}
lower_bound = i;
}
if(lower_bound == -1)
{
out.color[0] = colors[0];
}
else
{
float lower_value = boundary_points[lower_bound];
float interval = boundary_points[lower_bound+1]-lower_value;
out.color[0] = lerp( colors[lower_bound], colors[lower_bound+1], (height-lower_value)/interval );
}
return true;
}
开发者ID:whztt07,项目名称:SALVIA,代码行数:38,代码来源:VertexTextureFetch.cpp
注:本文中的vs_output类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论