本文整理汇总了C++中GfMatrix4d::GetArray方法的典型用法代码示例。如果您正苦于以下问题:C++ GfMatrix4d::GetArray方法的具体用法?C++ GfMatrix4d::GetArray怎么用?C++ GfMatrix4d::GetArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GfMatrix4d
的用法示例。
在下文中一共展示了GfMatrix4d::GetArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
else if( typeName == SdfValueTypeNames->Float4 )
{
GfVec4f usdVal;
primvar.Get( &usdVal, time );
return new GT_Real32Array( usdVal.data(), 1, 4 );
}
else if( typeName == SdfValueTypeNames->Double4 )
{
GfVec4d usdVal;
primvar.Get( &usdVal, time );
return new GT_Real64Array( usdVal.data(), 1, 4 );
}
else if( typeName == SdfValueTypeNames->Quatf )
{
GfVec4f usdVal;
primvar.Get( &usdVal, time );
return new GT_Real32Array( usdVal.data(), 1, 4, GT_TYPE_QUATERNION );
}
else if( typeName == SdfValueTypeNames->Quatd )
{
GfVec4d usdVal;
primvar.Get( &usdVal, time );
return new GT_Real64Array( usdVal.data(), 1, 4, GT_TYPE_QUATERNION );
}
else if( typeName == SdfValueTypeNames->Matrix3d )
{
GfMatrix3d usdVal;
primvar.Get( &usdVal, time );
return new GT_Real64Array( usdVal.GetArray(), 1, 9, GT_TYPE_MATRIX3 );
}
else if( typeName == SdfValueTypeNames->Matrix4d ||
typeName == SdfValueTypeNames->Frame4d )
{
GfMatrix4d usdVal;
primvar.Get( &usdVal, time );
return new GT_Real64Array( usdVal.GetArray(), 1, 16, GT_TYPE_MATRIX );
}
else if( typeName == SdfValueTypeNames->String )
{
string usdVal;
primvar.Get( &usdVal, time );
auto gtString = new GT_DAIndexedString( 1 );
gtString->setString( 0, 0, usdVal.c_str() );
return gtString;
}
else if( typeName == SdfValueTypeNames->StringArray )
{
VtArray<string> usdVal;
primvar.ComputeFlattened( &usdVal, time );
auto gtString = new GT_DAIndexedString( usdVal.size() );
for( size_t i = 0; i < usdVal.size(); ++i )
gtString->setString( i, 0, usdVal[i].c_str() );
return gtString;
}
else if( typeName == SdfValueTypeNames->IntArray )
{
VtArray<int> usdVal;
primvar.ComputeFlattened( &usdVal, time );
return new GusdGT_VtArray<int>(usdVal);
示例2: sourcesBldr
//.........这里部分代码省略.........
//
// Build instances.
//
FnGeolibServices::StaticSceneCreateOpArgsBuilder instancesBldr(false);
instancesBldr.createEmptyLocation("instances", "instance array");
instancesBldr.setAttrAtLocation("instances",
"geometry.instanceSource",
FnKat::StringAttribute(instanceSources, 1));
instancesBldr.setAttrAtLocation("instances",
"geometry.instanceIndex",
FnKat::IntAttribute(&instanceIndices[0],
instanceIndices.size(), 1));
FnKat::DoubleBuilder instanceMatrixBldr(16);
for (size_t a = 0; a < numXformSamples; ++a) {
double relSampleTime = motionSampleTimes[a];
// Shove samples into the builder at the frame-relative sample time. If
// motion is backwards, make sure to reverse time samples.
std::vector<double> &matVec = instanceMatrixBldr.get(
data.IsMotionBackward()
? PxrUsdKatanaUtils::ReverseTimeSample(relSampleTime)
: relSampleTime);
matVec.reserve(16 * numInstances);
for (size_t i = 0; i < numInstances; ++i) {
GfMatrix4d instanceXform = xformSamples[a][i];
const double *matArray = instanceXform.GetArray();
for (int j = 0; j < 16; ++j) {
matVec.push_back(matArray[j]);
}
}
}
instancesBldr.setAttrAtLocation("instances",
"geometry.instanceMatrix", instanceMatrixBldr.build());
if (!omitList.empty())
{
instancesBldr.setAttrAtLocation("instances",
"geometry.omitList",
FnKat::IntAttribute(&omitList[0], omitList.size(), 1));
}
instancesBldr.setAttrAtLocation("instances",
"geometry.pointInstancerId",
FnKat::StringAttribute(katOutputPath));
//
// Transfer primvars.
//
FnKat::GroupBuilder instancerPrimvarsBldr;
FnKat::GroupBuilder instancesPrimvarsBldr;
for (int64_t i = 0; i < primvarAttrs.getNumberOfChildren(); ++i)
{
const std::string primvarName = primvarAttrs.getChildName(i);
// Use "point" scope for the instancer.
instancerPrimvarsBldr.set(primvarName, primvarAttrs.getChildByIndex(i));
示例3: SetUseLighting
void
GlfSimpleLightingContext::SetStateFromOpenGL()
{
// import classic GL light's parameters into shaded lights
SetUseLighting(glIsEnabled(GL_LIGHTING));
GfMatrix4d worldToViewMatrix;
glGetDoublev(GL_MODELVIEW_MATRIX, worldToViewMatrix.GetArray());
GfMatrix4d viewToWorldMatrix = worldToViewMatrix.GetInverse();
GLint nLights = 0;
glGetIntegerv(GL_MAX_LIGHTS, &nLights);
GlfSimpleLightVector lights;
lights.reserve(nLights);
GlfSimpleLight light;
for(int i = 0; i < nLights; ++i)
{
int lightName = GL_LIGHT0 + i;
if (glIsEnabled(lightName)) {
GLfloat position[4], color[4];
glGetLightfv(lightName, GL_POSITION, position);
light.SetPosition(GfVec4f(position)*viewToWorldMatrix);
glGetLightfv(lightName, GL_AMBIENT, color);
light.SetAmbient(GfVec4f(color));
glGetLightfv(lightName, GL_DIFFUSE, color);
light.SetDiffuse(GfVec4f(color));
glGetLightfv(lightName, GL_SPECULAR, color);
light.SetSpecular(GfVec4f(color));
lights.push_back(light);
}
}
SetLights(lights);
GlfSimpleMaterial material;
GLfloat color[4], shininess;
glGetMaterialfv(GL_FRONT, GL_AMBIENT, color);
material.SetAmbient(GfVec4f(color));
glGetMaterialfv(GL_FRONT, GL_DIFFUSE, color);
material.SetDiffuse(GfVec4f(color));
glGetMaterialfv(GL_FRONT, GL_SPECULAR, color);
material.SetSpecular(GfVec4f(color));
glGetMaterialfv(GL_FRONT, GL_EMISSION, color);
material.SetEmission(GfVec4f(color));
glGetMaterialfv(GL_FRONT, GL_SHININESS, &shininess);
// clamp to 0.0001, since pow(0,0) is undefined in GLSL.
shininess = std::max(0.0001f, shininess);
material.SetShininess(shininess);
SetMaterial(material);
GfVec4f sceneAmbient;
glGetFloatv(GL_LIGHT_MODEL_AMBIENT, &sceneAmbient[0]);
SetSceneAmbient(sceneAmbient);
}