本文整理汇总了C++中List::Buffer方法的典型用法代码示例。如果您正苦于以下问题:C++ List::Buffer方法的具体用法?C++ List::Buffer怎么用?C++ List::Buffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类List
的用法示例。
在下文中一共展示了List::Buffer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AutotuneTex
void ChoiceForm::AutotuneTex()
{
additionalAttribs.Clear();
auto texs = choiceControl->GetPrecomputedTextures(currentShaderName);
auto choices = choiceControl->GetChoices(currentShaderName, EnumerableDictionary<String, Spire::Compiler::ShaderChoiceValue>());
for (auto & t : texs)
{
String choiceName;
String searchKey = L"." + t.Key;
for (auto & choice : choices)
if (choice.ChoiceName.EndsWith(searchKey))
choiceName = choice.ChoiceName;
if (choiceName.Length() == 0)
break;
int w, h;
t.Value.GetSize(w, h);
List<float> data;
data.SetSize(w*h*4);
t.Value.GetComponents();
for (auto & pix : data) pix = 0.0f;
t.Value.GetData(0, DataType::Float4, data.Buffer(), w * h);
bool isNormal = true, isColor = true;
for (auto & pix : data)
{
if (!isNormal && !isColor)
break;
if (pix > 1.001f)
{
isColor = false;
isNormal = false;
}
if (pix < -0.001)
{
isColor = false;
}
if (pix < -1.001)
{
isNormal = false;
}
}
printf("PrecomputedTex %s: N=%d, C=%d\n", t.Key.ToMultiByteString(), isNormal?1:0, isColor?1:0);
if (isColor)
{
EnumerableDictionary<String, String> attribs;
attribs[L"Storage"] = L"RGBA8";
additionalAttribs[choiceName] = attribs;
}
else if (isNormal)
{
EnumerableDictionary<String, String> attribs;
attribs[L"Normal"] = L"1";
additionalAttribs[choiceName] = attribs;
}
}
Recompile();
}
示例2:
List<Vec4> ChoiceForm::ReadFrameData(GL::Texture2D tex)
{
List<Vec4> rs;
int w, h;
tex.GetSize(w, h);
rs.SetSize(w*h);
tex.GetData(0, DataType::Float4, rs.Buffer(), rs.Count()*sizeof(Vec4));
return rs;
}