本文整理汇总了C++中MapList::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ MapList::empty方法的具体用法?C++ MapList::empty怎么用?C++ MapList::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapList
的用法示例。
在下文中一共展示了MapList::empty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: compile
//.........这里部分代码省略.........
"vec4 sampleDiffuse(float map, vec2 coord) {\n"
" return texture(diffuseArray, vec3(coord, map));\n"
"}\n";
source +=
"vec4 sampleNormal(float map, vec2 coord) {\n"
" vec4 n = texture(diffuseArray, vec3(coord, map));\n"
" return vec4(n.xyz * 2.0 - 1.0, n.w);\n"
"}\n\n\n";
// Main function
source +=
"// Main shader function\n"
"void main() {\n"
" vec4 diffuse = vec4(1,1,1,1);\n"
" vec4 normal = vec4(0,1,0,0);\n"
" float gloss = 0.0;\n"
" float height;\n"
" float weight;\n"
" vec4 diff, norm;\n"
" vec3 triplanar = max( (abs(worldNormal) - 0.2) * 0.7, 0.0);\n"
" triplanar /= dot(triplanar, vec3(1,1,1));\n"
" vec3 autoValue = vec3(worldPos.y, 1.0 - worldNormal.y, 0.0);\n"
" \n";
// Vertical projection data
source +=
" vec3 vertical = vec3(triplanar.x, 0, triplanar.z);\n"
" vertical /= triplanar.y>0.99? 1: dot(vertical, vec3(1,1,1));\n\n";
// Sample maps
if(!maps.empty()) {
source += " // Sample maps\n";
for(MapList::iterator i=maps.begin(); i!=maps.end(); ++i) {
source += " vec4 " + *i + "Sample = sampleMap(" + *i + "Map, " + *i + "Info, worldPos.xz);\n";
}
source += "\n";
}
// Apply layers
const std::string rgba[] = { "r", "g", "b", "a" };
for(size_t i=0; i<m_layers.size(); ++i) {
std::string index = str(i);
MaterialLayer* layer = m_layers[i];
Colour colour(layer->colour);
bool valid = true;
source += " // Layer " + str(layer->name) + "\n";
switch(layer->type) {
case LAYER_AUTO:
source += " weight = getAutoWeight(autoValue, autoMin"+index+", autoMax"+index+", autoBlend"+index+");\n";
break;
case LAYER_WEIGHT:
if(!layer->map || !layer->map[0]) valid = false;
else if(layer->mapData<4)
source += " weight = " + str(layer->map) + "Sample." + rgba[layer->mapData] + ";\n";
else
source += " weight = 1.0 - dot(" + str(layer->map) + "Sample, vec4(1,1,1,1));\n";
break;
case LAYER_COLOUR:
if(!layer->map || !layer->map[0]) valid = false;