本文整理汇总了C++中IsEquivalent函数的典型用法代码示例。如果您正苦于以下问题:C++ IsEquivalent函数的具体用法?C++ IsEquivalent怎么用?C++ IsEquivalent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsEquivalent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadTransformSkew
bool FArchiveXML::LoadTransformSkew(FCDObject* object, xmlNode* skewNode)
{
FCDTSkew* tSkew = (FCDTSkew*)object;
const char* content = FUDaeParser::ReadNodeContentDirect(skewNode);
FloatList factors;
factors.reserve(7);
FUStringConversion::ToFloatList(content, factors);
if (factors.size() != 7) return false;
tSkew->SetAngle(factors[0]);
tSkew->SetRotateAxis(FMVector3(factors[1], factors[2], factors[3]));
tSkew->SetAroundAxis(FMVector3(factors[4], factors[5], factors[6]));
// Check and pre-process the axises
if (IsEquivalent(tSkew->GetRotateAxis(), FMVector3::Origin) || IsEquivalent(tSkew->GetAroundAxis(), FMVector3::Origin)) return false;
tSkew->SetRotateAxis(tSkew->GetRotateAxis().Normalize());
tSkew->SetAroundAxis(tSkew->GetAroundAxis().Normalize());
// Register the animated values
FArchiveXML::LoadAnimatable(&tSkew->GetSkew(), skewNode);
tSkew->SetDirtyFlag();
return true;
}
示例2: FromString
Mode FromString(const char* value)
{
if (IsEquivalent(value, DAE_FX_STATE_POLYMODE_POINT)) return POINT;
else if (IsEquivalent(value, DAE_FX_STATE_POLYMODE_LINE)) return LINE;
else if (IsEquivalent(value, DAE_FX_STATE_POLYMODE_FILL)) return FILL;
else return INVALID;
}
示例3: FindParameters
// Returns a list of parameter names and nodes held by a given XML node
void FindParameters(xmlNode* parent, StringList& parameterNames, xmlNodeList& parameterNodes)
{
if (parent == NULL || parameterNames.size() != parameterNodes.size()) return;
size_t originalCount = parameterNodes.size();
for (xmlNode* child = parent->children; child != NULL; child = child->next)
{
if (child->type != XML_ELEMENT_NODE) continue;
// Drop the technique and exta elements that may be found
if (IsEquivalent(child->name, DAE_TECHNIQUE_ELEMENT) ||
IsEquivalent(child->name, DAE_EXTRA_ELEMENT)) continue;
// Buffer this parameter node
parameterNodes.push_back(child);
}
// Retrieve all the parameter's names
size_t parameterNodeCount = parameterNodes.size();
parameterNames.resize(parameterNodeCount);
for (size_t i = originalCount; i < parameterNodeCount; ++i)
{
xmlNode* node = parameterNodes[i];
parameterNames[i] = (const char*) node->name;
}
}
示例4: CheckExtraTree
bool CheckExtraTree(FULogFile& fileOut, FCDExtra* extra, bool hasTypes)
{
FailIf(extra == NULL);
// Find and verify the one technique
FailIf(extra->GetDefaultType()->GetTechniqueCount() < 1); // note that FCDLight adds some <extra> elements of its own.
FCDETechnique* technique = extra->GetDefaultType()->FindTechnique("FCTEI_TestProfile");
FailIf(technique == NULL);
// Find and verify the base parameter tree node
FailIf(technique->GetChildNodeCount() != 1);
FCDENode* baseNode = technique->GetChildNode(0);
PassIf(baseNode != NULL);
PassIf(extra->GetDefaultType()->FindRootNode("MainParameterTree") == baseNode);
// Verify the base node attributes
PassIf(baseNode->GetAttributeCount() == 2);
FCDEAttribute* a1 = baseNode->FindAttribute("Vicious");
FCDEAttribute* a2 = baseNode->FindAttribute("Gross");
FailIf(a1 == NULL);
FailIf(a2 == NULL);
FailIf(a1 == a2);
PassIf(IsEquivalent(a1->GetValue(), FC("Squirrel")));
PassIf(IsEquivalent(FUStringConversion::ToUInt32(a2->GetValue()), (uint32)1002));
// Identify the base node leaves
PassIf(baseNode->GetChildNodeCount() == 2);
FCDENode* leaf0 = NULL,* leaf3 = NULL;
for (size_t i = 0; i < 2; ++i)
{
FCDENode* leaf = baseNode->GetChildNode(i);
PassIf(IsEquivalent(leaf->GetName(), "SomeParameter"));
FCDEAttribute* guts = leaf->FindAttribute("Guts");
FailIf(guts == NULL || guts->GetValue().empty());
uint32 gutsIndex = FUStringConversion::ToUInt32(guts->GetValue());
if (gutsIndex == 0) { FailIf(leaf0 != NULL); leaf0 = leaf; }
else if (gutsIndex == 3) { FailIf(leaf3 != NULL); leaf3 = leaf; }
else Fail;
}
FailIf(leaf0 == NULL || leaf3 == NULL);
// Verify the base node leaves
PassIf(leaf0->GetChildNodeCount() == 0);
PassIf(leaf3->GetChildNodeCount() == 0);
PassIf(leaf0->GetAttributeCount() == 1);
PassIf(leaf3->GetAttributeCount() == 1);
PassIf(IsEquivalent(leaf0->GetContent(), FC("Test_SomeParameter")));
PassIf(IsEquivalent(leaf3->GetContent(), FS("Test_ThatParameter!")));
if (hasTypes)
{
// Verify the second extra type
// Empty named-types should be imported without complaints or merging.
FCDEType* secondType = extra->FindType("verificator");
PassIf(secondType != NULL);
PassIf(secondType != extra->GetDefaultType());
PassIf(secondType->GetTechniqueCount() == 0);
}
return true;
}
示例5: LoadPASSphere
bool FArchiveXML::LoadPASSphere(FCDObject* object, xmlNode* node)
{
FCDPASSphere* pASSphere = (FCDPASSphere*)object;
bool status = true;
if (!IsEquivalent(node->name, DAE_SPHERE_ELEMENT))
{
FUError::Error(FUError::WARNING_LEVEL, FUError::WARNING_INVALID_SPHERE_TYPE, node->line);
return status;
}
for (xmlNode* child = node->children; child != NULL; child = child->next)
{
if (child->type != XML_ELEMENT_NODE) continue;
if (IsEquivalent(child->name, DAE_RADIUS_ELEMENT))
{
pASSphere->radius = FUStringConversion::ToFloat(ReadNodeContentDirect(child));
}
}
pASSphere->SetDirtyFlag();
return status;
}
示例6: if
bool FArchiveXML::LoadPASCylinder(FCDObject* object, xmlNode* node)
{
FCDPASCylinder* pASCylinder = (FCDPASCylinder*)object;
bool status = true;
if (!IsEquivalent(node->name, DAE_CYLINDER_ELEMENT))
{
FUError::Error(FUError::WARNING_LEVEL, FUError::WARNING_INVALID_SPHERE_TYPE, node->line);
return status;
}
for (xmlNode* child = node->children; child != NULL; child = child->next)
{
if (child->type != XML_ELEMENT_NODE) continue;
if (IsEquivalent(child->name, DAE_HEIGHT_ELEMENT))
{
pASCylinder->height = FUStringConversion::ToFloat(ReadNodeContentDirect(child));
}
else if (IsEquivalent(child->name, DAE_RADIUS_ELEMENT))
{
const char* stringRadius = ReadNodeContentDirect(child);
pASCylinder->radius.x = FUStringConversion::ToFloat(&stringRadius);
pASCylinder->radius.y = FUStringConversion::ToFloat(&stringRadius);
}
}
pASCylinder->SetDirtyFlag();
return status;
}
示例7: LoadPASPlane
bool FArchiveXML::LoadPASPlane(FCDObject* object, xmlNode* node)
{
FCDPASPlane* pASPlane = (FCDPASPlane*)object;
bool status = true;
if (!IsEquivalent(node->name, DAE_PLANE_ELEMENT))
{
FUError::Error(FUError::WARNING_LEVEL, FUError::WARNING_INVALID_PLANE_TYPE, node->line);
return status;
}
for (xmlNode* child = node->children; child != NULL; child = child->next)
{
if (child->type != XML_ELEMENT_NODE) continue;
if (IsEquivalent(child->name, DAE_EQUATION_ELEMENT))
{
const char* eq = ReadNodeContentDirect(child);
pASPlane->normal.x = FUStringConversion::ToFloat(&eq);
pASPlane->normal.y = FUStringConversion::ToFloat(&eq);
pASPlane->normal.z = FUStringConversion::ToFloat(&eq);
pASPlane->d = FUStringConversion::ToFloat(&eq);
}
}
pASPlane->SetDirtyFlag();
return status;
}
示例8: LoadPASBox
bool FArchiveXML::LoadPASBox(FCDObject* object, xmlNode* node)
{
FCDPASBox* pASBox = (FCDPASBox*)object;
bool status = true;
if (!IsEquivalent(node->name, DAE_BOX_ELEMENT))
{
FUError::Error(FUError::WARNING_LEVEL, FUError::WARNING_INVALID_BOX_TYPE, node->line);
return status;
}
for (xmlNode* child = node->children; child != NULL; child = child->next)
{
if (child->type != XML_ELEMENT_NODE) continue;
if (IsEquivalent(child->name, DAE_HALF_EXTENTS_ELEMENT))
{
const char* halfExt = ReadNodeContentDirect(child);
pASBox->halfExtents.x = FUStringConversion::ToFloat(&halfExt);
pASBox->halfExtents.y = FUStringConversion::ToFloat(&halfExt);
pASBox->halfExtents.z = FUStringConversion::ToFloat(&halfExt);
}
}
pASBox->SetDirtyFlag();
return status;
}
示例9: IsEquivalent
bool FCDTRotation::IsInverse(const FCDTransform* transform) const
{
return transform->GetType() == FCDTransform::ROTATION
&& ((IsEquivalent(angleAxis->axis, ((const FCDTRotation*)transform)->angleAxis->axis)
&& IsEquivalent(-angleAxis->angle, ((const FCDTRotation*)transform)->angleAxis->angle))
|| (IsEquivalent(-angleAxis->axis, ((const FCDTRotation*)transform)->angleAxis->axis)
&& IsEquivalent(angleAxis->angle, ((const FCDTRotation*)transform)->angleAxis->angle)));
}
示例10: PlatformEquivalent
inline bool PlatformEquivalent(fstring& f, const fchar* check)
{
#ifdef WIN32
return IsEquivalent(f, check);
#else
fstring p = check;
p.replace('\\', '/');
return IsEquivalent(f, p);
#endif // WIN32
}
示例11: CheckControllerSkin
bool CheckControllerSkin(FULogFile& fileOut, FCDSkinController* controller)
{
FailIf(controller == NULL);
// Check the base target's identity
FailIf(controller->GetTarget() == NULL);
PassIf(controller->GetTarget()->GetType() == FCDEntity::GEOMETRY);
PassIf(controller->GetTarget()->GetDaeId() == meshId);
// Retrieve the two joints and verify their ids/bind-pose.
PassIf(controller->GetJointCount() == 2);
const FMMatrix44* joint1 = NULL,* joint2 = NULL;
for (size_t i = 0; i < 2; ++i)
{
FCDSkinControllerJoint* joint = controller->GetJoint(i);
if (joint->GetId() == jointId1) { FailIf(joint1 != NULL); joint1 = &joint->GetBindPoseInverse(); }
else if (joint->GetId() == jointId2) { FailIf(joint2 != NULL); joint2 = &joint->GetBindPoseInverse(); }
else Fail;
}
FailIf(joint1 == NULL || joint2 == NULL);
PassIf(IsEquivalent(*joint1, FMMatrix44::Identity));
FMMatrix44 sbp = FMMatrix44(sampleBindPose1).Inverted();
PassIf(IsEquivalent(*joint2, FMMatrix44(sampleBindPose1).Inverted()));
// Verify the influences
PassIf(controller->GetInfluenceCount() == 4);
FCDSkinControllerVertex* influence = controller->GetVertexInfluence(0);
FailIf(influence == NULL);
PassIf(influence->GetPairCount() == 2);
PassIf(IsEquivalent(influence->GetPair(0)->jointIndex, 0));
PassIf(IsEquivalent(influence->GetPair(0)->weight, 0.5f));
PassIf(IsEquivalent(influence->GetPair(1)->jointIndex, 1));
PassIf(IsEquivalent(influence->GetPair(1)->weight, 0.5f));
influence = controller->GetVertexInfluence(1);
FailIf(influence == NULL);
PassIf(influence->GetPairCount() == 0);
influence = controller->GetVertexInfluence(2);
FailIf(influence == NULL);
PassIf(influence->GetPairCount() == 1);
PassIf(IsEquivalent(influence->GetPair(0)->jointIndex, 0));
PassIf(IsEquivalent(influence->GetPair(0)->weight, 1.0f)); // the weight should have been normalized.
influence = controller->GetVertexInfluence(3);
FailIf(influence == NULL);
PassIf(influence->GetPairCount() == 1);
PassIf(IsEquivalent(influence->GetPair(0)->jointIndex, 1));
PassIf(IsEquivalent(influence->GetPair(0)->weight, 1.0f));
return true;
}
示例12: CheckGeometryMesh
bool CheckGeometryMesh(FULogFile& fileOut, FCDGeometryMesh* mesh)
{
// Verify the mesh and its sources
PassIf(mesh->GetSourceCount() == 3);
FCDGeometrySource* posSource = NULL,* colorSource = NULL,* dummySource = NULL;
for (size_t i = 0; i < 3; ++i)
{
FCDGeometrySource* source = mesh->GetSource(i);
FailIf(source == NULL);
switch (source->GetType())
{
case FUDaeGeometryInput::POSITION: posSource = source; PassIf(source->GetName() == FC("TestPositionSource")); break;
case FUDaeGeometryInput::COLOR: colorSource = source; PassIf(source->GetName() == FC("TestColorSource")); break;
case FUDaeGeometryInput::EXTRA: dummySource = source; PassIf(source->GetName() == FC("TestDummySource")); break;
default: Fail; break;
}
}
FailIf(posSource == NULL || colorSource == NULL || dummySource == NULL);
PassIf(IsEquivalent(posSource->GetData(), posSource->GetDataCount(), positionData, 12));
PassIf(posSource->GetStride() == 3);
PassIf(IsEquivalent(colorSource->GetData(), colorSource->GetDataCount(), colorData, 12));
PassIf(colorSource->GetStride() == 4);
PassIf(IsEquivalent(dummySource->GetData(), dummySource->GetDataCount(), dummyData, 10));
PassIf(dummySource->GetStride() == 3);
PassIf(CheckExtraTree(fileOut, dummySource->GetExtra(), false));
// Find the non-empty polygon set and verify that one of the polygon set is, in fact, empty.
FCDGeometryPolygons* polys1 = NULL,* polysEmpty = NULL;
for (size_t i = 0; i < mesh->GetPolygonsCount(); ++i)
{
FCDGeometryPolygons* p = mesh->GetPolygons(i);
if (p->GetFaceCount() == 0) { PassIf(polysEmpty == NULL); polysEmpty = p; }
else { PassIf(polys1 == NULL); polys1 = p; }
CheckExtraTree(fileOut, p->GetExtra(), true);
}
PassIf(polys1 != NULL && polysEmpty != NULL);
// Check that we have the wanted tetrahedron in the non-empty polygon set.
PassIf(polys1->GetFaceCount() == 4);
PassIf(polys1->GetHoleCount() == 0);
PassIf(polys1->GetFaceVertexCount(0) == 3 && polys1->GetFaceVertexCount(1) == 3 && polys1->GetFaceVertexCount(2) == 3 && polys1->GetFaceVertexCount(3) == 3);
FCDGeometryPolygonsInput* posInput = polys1->FindInput(posSource);
FailIf(posInput == NULL || posInput->GetIndexCount() != 12);
FCDGeometryPolygonsInput* colorInput = polys1->FindInput(colorSource);
FailIf(colorInput == NULL || colorInput == posInput || colorInput->GetIndexCount() != 12);
PassIf(IsEquivalent(posInput->GetIndices(), 12, positionIndices, 12));
PassIf(IsEquivalent(colorInput->GetIndices(), 12, colorIndices, 12));
return true;
}
示例13: scheme
FUUri::FUUri(const fstring uri, bool escape)
: scheme(FUUri::NONE),
port(0),
path(FC(""))
{
if (uri.empty()) return;
fstring _uri;
if (escape)
{
_uri = Escape(uri);
}
else
{
_uri = uri;
}
// Replace all '\\' characters by '/' so the path is only using them
//_uri.replace(FC('\\'), FC('/'));
_uri = FixFuxedUpColladaPaths( _uri );
// Find the scheme from its ':' delimiter
size_t schemeDelimiterIndex = _uri.find(FC(':'));
size_t hostIndex = 0;
if (schemeDelimiterIndex != fstring::npos && schemeDelimiterIndex > 1)
{
fstring _scheme = _uri.substr(0, schemeDelimiterIndex);
if (IsEquivalent(_scheme, FC("FILE")) || IsEquivalent(_scheme, FC("file")))
{
scheme = FUUri::FILE;
}
else if (IsEquivalent(_scheme, FC("FTP")) || IsEquivalent(_scheme, FC("ftp")))
{
scheme = FUUri::FTP;
}
else if (IsEquivalent(_scheme, FC("HTTP")) || IsEquivalent(_scheme, FC("http")))
{
scheme = FUUri::HTTP;
}
else if (IsEquivalent(_scheme, FC("HTTPS")) || IsEquivalent(_scheme, FC("https")))
{
scheme = FUUri::HTTPS;
}
else
{
#ifdef WIN32
// Scheme not supported (could be a NFS path)
FUFail(return);
#endif // WIN32
}
schemeDelimiter = _uri.substr(schemeDelimiterIndex, 3);
hostIndex = schemeDelimiterIndex + 3;
}
示例14: floor
FMVector4 FMVector4::FromHSVColor(float hue, float saturation, float value)
{
// [GLaforte - 15-04-2007]
// Algorithm inspired from http://www.cs.rit.edu/~ncs/color/t_convert.html
// Written by Nan C. Schaller, Rochester Institute of Technology, Computer Science Department
if (!IsEquivalent(saturation, 0.0f))
{
hue *= 6.0f; // sector 0 to 5
float sector = floor(hue);
float f = hue - sector; // factorial part of h
float p = value * (1.0f - saturation);
float q = value * (1.0f - saturation * f);
float t = value * (1.0f - saturation * (1.0f - f));
switch ((uint32) sector)
{
case 0: return FMVector4(value, t, p, 1.0f);
case 1: return FMVector4(q, value, p, 1.0f);
case 2: return FMVector4(p, value, t, 1.0f);
case 3: return FMVector4(p, q, value, 1.0f);
case 4: return FMVector4(t, p, value, 1.0f);
case 5:
default: return FMVector4(value, p, q, 1.0f);
}
}
else return FMVector4(value, value, value, 1.0f); // Achromatic (grey)
}
示例15: LoadPhysicsForceFieldInstance
bool FArchiveXML::LoadPhysicsForceFieldInstance(FCDObject* object, xmlNode* instanceNode)
{
if (!FArchiveXML::LoadEntityInstance(object, instanceNode)) return false;
bool status = true;
FCDPhysicsForceFieldInstance* physicsForceFieldInstance = (FCDPhysicsForceFieldInstance*)object;
if (physicsForceFieldInstance->GetEntity() == NULL && !physicsForceFieldInstance->IsExternalReference())
{
FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_INVALID_URI,
instanceNode->line);
}
// Check for the expected instantiation node type
if (!IsEquivalent(instanceNode->name, DAE_INSTANCE_FORCE_FIELD_ELEMENT))
{
FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_UNKNOWN_ELEMENT,
instanceNode->line);
status = false;
}
// nothing interesting in force field instance to load
physicsForceFieldInstance->SetDirtyFlag();
return status;
}