本文整理汇总了C++中TType::getCols方法的典型用法代码示例。如果您正苦于以下问题:C++ TType::getCols方法的具体用法?C++ TType::getCols怎么用?C++ TType::getCols使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TType
的用法示例。
在下文中一共展示了TType::getCols方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GLVariableType
GLenum GLVariableType(const TType &type)
{
if (type.getBasicType() == EbtFloat)
{
if (type.isScalar())
{
return GL_FLOAT;
}
else if (type.isVector())
{
switch (type.getNominalSize())
{
case 2: return GL_FLOAT_VEC2;
case 3: return GL_FLOAT_VEC3;
case 4: return GL_FLOAT_VEC4;
default: UNREACHABLE();
}
}
else if (type.isMatrix())
{
switch (type.getCols())
{
case 2:
switch (type.getRows())
{
case 2: return GL_FLOAT_MAT2;
case 3: return GL_FLOAT_MAT2x3;
case 4: return GL_FLOAT_MAT2x4;
default: UNREACHABLE();
}
case 3:
switch (type.getRows())
{
case 2: return GL_FLOAT_MAT3x2;
case 3: return GL_FLOAT_MAT3;
case 4: return GL_FLOAT_MAT3x4;
default: UNREACHABLE();
}
case 4:
switch (type.getRows())
{
case 2: return GL_FLOAT_MAT4x2;
case 3: return GL_FLOAT_MAT4x3;
case 4: return GL_FLOAT_MAT4;
default: UNREACHABLE();
}
default: UNREACHABLE();
}
}
else UNREACHABLE();
}
else if (type.getBasicType() == EbtInt)
{
if (type.isScalar())
{
return GL_INT;
}
else if (type.isVector())
{
switch (type.getNominalSize())
{
case 2: return GL_INT_VEC2;
case 3: return GL_INT_VEC3;
case 4: return GL_INT_VEC4;
default: UNREACHABLE();
}
}
else UNREACHABLE();
}
else if (type.getBasicType() == EbtUInt)
{
if (type.isScalar())
{
return GL_UNSIGNED_INT;
}
else if (type.isVector())
{
switch (type.getNominalSize())
{
case 2: return GL_UNSIGNED_INT_VEC2;
case 3: return GL_UNSIGNED_INT_VEC3;
case 4: return GL_UNSIGNED_INT_VEC4;
default: UNREACHABLE();
}
}
else UNREACHABLE();
}
else if (type.getBasicType() == EbtBool)
{
if (type.isScalar())
{
return GL_BOOL;
}
else if (type.isVector())
{
switch (type.getNominalSize())
{
//.........这里部分代码省略.........
示例2: TypeString
TString TypeString(const TType &type)
{
const TStructure *structure = type.getStruct();
if (structure)
{
if (structure->symbolType() != SymbolType::Empty)
{
return StructNameString(*structure);
}
else // Nameless structure, define in place
{
return StructureHLSL::defineNameless(*structure);
}
}
else if (type.isMatrix())
{
int cols = type.getCols();
int rows = type.getRows();
return "float" + str(cols) + "x" + str(rows);
}
else
{
switch (type.getBasicType())
{
case EbtFloat:
switch (type.getNominalSize())
{
case 1:
return "float";
case 2:
return "float2";
case 3:
return "float3";
case 4:
return "float4";
}
case EbtInt:
switch (type.getNominalSize())
{
case 1:
return "int";
case 2:
return "int2";
case 3:
return "int3";
case 4:
return "int4";
}
case EbtUInt:
switch (type.getNominalSize())
{
case 1:
return "uint";
case 2:
return "uint2";
case 3:
return "uint3";
case 4:
return "uint4";
}
case EbtBool:
switch (type.getNominalSize())
{
case 1:
return "bool";
case 2:
return "bool2";
case 3:
return "bool3";
case 4:
return "bool4";
}
case EbtVoid:
return "void";
case EbtSampler2D:
case EbtISampler2D:
case EbtUSampler2D:
case EbtSampler2DArray:
case EbtISampler2DArray:
case EbtUSampler2DArray:
return "sampler2D";
case EbtSamplerCube:
case EbtISamplerCube:
case EbtUSamplerCube:
return "samplerCUBE";
case EbtSamplerExternalOES:
return "sampler2D";
case EbtAtomicCounter:
// Multiple atomic_uints will be implemented as a single RWByteAddressBuffer
return "RWByteAddressBuffer";
default:
break;
}
}
UNREACHABLE();
return "<unknown type>";
}
示例3: addConstructor
//.........这里部分代码省略.........
}
else // Built-in type
{
constructor += TypeString(ctorType) + " " + name + "(";
}
for (unsigned int parameter = 0; parameter < ctorParameters.size(); parameter++)
{
const TType ¶mType = ctorParameters[parameter];
constructor += TypeString(paramType) + " x" + str(parameter) + ArrayString(paramType);
if (parameter < ctorParameters.size() - 1)
{
constructor += ", ";
}
}
constructor += ")\n"
"{\n";
if (ctorType.getStruct())
{
constructor += " " + name + " structure = {";
}
else
{
constructor += " return " + TypeString(ctorType) + "(";
}
if (ctorType.isMatrix() && ctorParameters.size() == 1)
{
int rows = ctorType.getRows();
int cols = ctorType.getCols();
const TType ¶meter = ctorParameters[0];
if (parameter.isScalar())
{
for (int col = 0; col < cols; col++)
{
for (int row = 0; row < rows; row++)
{
constructor += TString((row == col) ? "x0" : "0.0");
if (row < rows - 1 || col < cols - 1)
{
constructor += ", ";
}
}
}
}
else if (parameter.isMatrix())
{
for (int col = 0; col < cols; col++)
{
for (int row = 0; row < rows; row++)
{
if (row < parameter.getRows() && col < parameter.getCols())
{
constructor += TString("x0") + "[" + str(col) + "][" + str(row) + "]";
}
else
{
constructor += TString((row == col) ? "1.0" : "0.0");
}
示例4: TypeString
TString TypeString(const TType &type)
{
const TStructure* structure = type.getStruct();
if (structure)
{
const TString& typeName = structure->name();
if (typeName != "")
{
return StructNameString(*structure);
}
else // Nameless structure, define in place
{
return StructureHLSL::defineNameless(*structure);
}
}
else if (type.isMatrix())
{
int cols = type.getCols();
int rows = type.getRows();
return "float" + str(cols) + "x" + str(rows);
}
else
{
switch (type.getBasicType())
{
case EbtFloat:
switch (type.getNominalSize())
{
case 1: return "float";
case 2: return "float2";
case 3: return "float3";
case 4: return "float4";
}
case EbtInt:
switch (type.getNominalSize())
{
case 1: return "int";
case 2: return "int2";
case 3: return "int3";
case 4: return "int4";
}
case EbtUInt:
switch (type.getNominalSize())
{
case 1: return "uint";
case 2: return "uint2";
case 3: return "uint3";
case 4: return "uint4";
}
case EbtBool:
switch (type.getNominalSize())
{
case 1: return "bool";
case 2: return "bool2";
case 3: return "bool3";
case 4: return "bool4";
}
case EbtVoid:
return "void";
case EbtSampler2D:
case EbtISampler2D:
case EbtUSampler2D:
case EbtSampler2DArray:
case EbtISampler2DArray:
case EbtUSampler2DArray:
return "sampler2D";
case EbtSamplerCube:
case EbtISamplerCube:
case EbtUSamplerCube:
return "samplerCUBE";
case EbtSamplerExternalOES:
return "sampler2D";
default:
break;
}
}
UNREACHABLE();
return "<unknown type>";
}
示例5: TypeToConstructorOperator
TOperator TypeToConstructorOperator(const TType &type)
{
switch (type.getBasicType())
{
case EbtFloat:
if (type.isMatrix())
{
switch (type.getCols())
{
case 2:
switch (type.getRows())
{
case 2:
return EOpConstructMat2;
case 3:
return EOpConstructMat2x3;
case 4:
return EOpConstructMat2x4;
default:
break;
}
break;
case 3:
switch (type.getRows())
{
case 2:
return EOpConstructMat3x2;
case 3:
return EOpConstructMat3;
case 4:
return EOpConstructMat3x4;
default:
break;
}
break;
case 4:
switch (type.getRows())
{
case 2:
return EOpConstructMat4x2;
case 3:
return EOpConstructMat4x3;
case 4:
return EOpConstructMat4;
default:
break;
}
break;
}
}
else
{
switch (type.getNominalSize())
{
case 1:
return EOpConstructFloat;
case 2:
return EOpConstructVec2;
case 3:
return EOpConstructVec3;
case 4:
return EOpConstructVec4;
default:
break;
}
}
break;
case EbtInt:
switch (type.getNominalSize())
{
case 1:
return EOpConstructInt;
case 2:
return EOpConstructIVec2;
case 3:
return EOpConstructIVec3;
case 4:
return EOpConstructIVec4;
default:
break;
}
break;
case EbtUInt:
switch (type.getNominalSize())
{
case 1:
return EOpConstructUInt;
case 2:
return EOpConstructUVec2;
case 3:
return EOpConstructUVec3;
case 4:
return EOpConstructUVec4;
default:
break;
}
//.........这里部分代码省略.........