当前位置: 首页>>代码示例>>C++>>正文


C++ Transforms类代码示例

本文整理汇总了C++中Transforms的典型用法代码示例。如果您正苦于以下问题:C++ Transforms类的具体用法?C++ Transforms怎么用?C++ Transforms使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Transforms类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Transforms_LookAt

Handle<Value> Transforms_LookAt(const Arguments& args)
{
    HandleScope handle_scope;

    Transforms* ptr = GetPtr(args.This());
    assert(ptr);

    if (((args.Length() >= 1) && (args.Length() <= 3)) && isJSVector3(args[0]))
    {
        Vector3 targetPoint = fromJSVector3Unsafe(args[0]);

        Transforms::tTransformSpace relativeTo = Transforms::TS_LOCAL;
        if ((args.Length() >= 2) && args[1]->IsUint32())
            relativeTo = (Transforms::tTransformSpace) args[1]->Uint32Value();

        Vector3 localDirectionVector = Vector3::NEGATIVE_UNIT_Z;
        if ((args.Length() == 3) && isJSVector3(args[2]))
            localDirectionVector = fromJSVector3Unsafe(args[2]);

        ptr->lookAt(targetPoint, relativeTo, localDirectionVector);

        return Handle<Value>();
    }

    return ThrowException(String::New("Invalid parameters, syntax: lookAt(targetPoint [, relativeTo [, localDirectionVector]])"));
}
开发者ID:Kanma,项目名称:Athena-Entities,代码行数:26,代码来源:Transforms.cpp

示例2: getRMSD

void getRMSD(MatrixWindow *_win1, MatrixWindow *_win2, System *_sys2){
    Transforms t;
    AtomVector ca1 = (*_win1).getSmallAVec();
    AtomVector ca2 = (*_win2).getSmallAVec();
    AtomVector a2 = (*_sys2).getAtoms();

    bool result = t.align(ca2, ca1, a2);
    if(!result){
	cout<<"Alignment has failed!"<<endl;
	exit(1211);
    }

    double r=ca1.rmsd(ca2);
    fprintf(stdout, "RMSD: %8.3f\n", r);

    //write out aligned pdb

    /*char a[80];
      sprintf(a, "/snap/cluster/jdegrado/pizza/%03d.aligned.%03d.pdb",j,i);

      PDBWriter w(a);
      w.write(a2);
      w.close();*/

}
开发者ID:Suncuss,项目名称:mslib,代码行数:25,代码来源:multiSearchDM.withbinary.cpp

示例3: switch

void Transforms::translate(const Vector3& d, tTransformSpace relativeTo)
{
    Vector3 adjusted;

    switch(relativeTo)
    {
    case TS_LOCAL:
        // Position is relative to parent so transform downwards
        m_position += m_orientation * d;
        break;

    case TS_PARENT:
        m_position += d;
        break;

    case TS_WORLD:
        {
            // Position is relative to parent so transform upwards
            Transforms* pParent = getTransforms();
            if (pParent)
                m_position += (pParent->getWorldOrientation().Inverse() * d) / pParent->getWorldScale();
            else
                m_position += d;
            break;
        }
    }

    needUpdate();
}
开发者ID:Kanma,项目名称:Athena-Entities,代码行数:29,代码来源:Transforms.cpp

示例4: setBaseTransform

 void setBaseTransform(const Transform& baseTransform)
 {
     assert (individualTransforms.size() == 1);
     assert (absoluteTransforms.size() == 1);
     
     individualTransforms.front() = absoluteTransforms.front() = baseTransform;
 }
开发者ID:cajun-code,项目名称:gosu,代码行数:7,代码来源:DrawOpQueue.hpp

示例5: Transforms_Translate

Handle<Value> Transforms_Translate(const Arguments& args)
{
    HandleScope handle_scope;

    Transforms* ptr = GetPtr(args.This());
    assert(ptr);

    if (((args.Length() == 1) || (args.Length() == 2)) && isJSVector3(args[0]))
    {
        Vector3 d = fromJSVector3Unsafe(args[0]);

        Transforms::tTransformSpace relativeTo = Transforms::TS_LOCAL;
        if ((args.Length() == 2) && args[1]->IsUint32())
            relativeTo = (Transforms::tTransformSpace) args[1]->Uint32Value();

        ptr->translate(d, relativeTo);

        return Handle<Value>();
    }
    else if (((args.Length() == 3) || (args.Length() == 4)) &&
             args[0]->IsNumber() && args[1]->IsNumber() && args[2]->IsNumber())
    {
        Transforms::tTransformSpace relativeTo = Transforms::TS_LOCAL;
        if ((args.Length() == 4) && args[3]->IsUint32())
            relativeTo = (Transforms::tTransformSpace) args[3]->Uint32Value();

        ptr->translate(args[0]->NumberValue(), args[1]->NumberValue(), args[2]->NumberValue(), relativeTo);

        return Handle<Value>();
    }

    return ThrowException(String::New("Invalid parameters, syntax: translate(vector3 [, transform_space]) or translate(dx, dy, dz [, transform_space])"));
}
开发者ID:Kanma,项目名称:Athena-Entities,代码行数:33,代码来源:Transforms.cpp

示例6: DrawOpQueue

 DrawOpQueue()
 {
     // Every queue has a base transform that is always the current transform.
     // This keeps the code a bit more uniform, and allows the window to
     // set a base transform in the main rendering queue.
     individualTransforms.push_back(scale(1));
     absoluteTransforms.push_back(scale(1));
 }
开发者ID:cajun-code,项目名称:gosu,代码行数:8,代码来源:DrawOpQueue.hpp

示例7: Transforms_SetOrientation

void Transforms_SetOrientation(Local<String> property, Local<Value> value, const AccessorInfo& info)
{
    HandleScope handle_scope;

    Transforms* ptr = GetPtr(info.This());
    assert(ptr);

    ptr->setOrientation(fromJSQuaternion(value));
}
开发者ID:Kanma,项目名称:Athena-Entities,代码行数:9,代码来源:Transforms.cpp

示例8: getTransforms

void Body::getWorldTransform(btTransform& worldTrans) const
{
    Transforms* pTransforms = getTransforms();
    if (pTransforms)
    {
        worldTrans = btTransform(toBullet(pTransforms->getWorldOrientation()),
                                 toBullet(pTransforms->getWorldPosition()));
    }
}
开发者ID:Kanma,项目名称:Athena-Physics,代码行数:9,代码来源:Body.cpp

示例9: Transforms_GetInheritScale

Handle<Value> Transforms_GetInheritScale(Local<String> property, const AccessorInfo &info)
{
    HandleScope handle_scope;

    Transforms* ptr = GetPtr(info.This());
    assert(ptr);

    return handle_scope.Close(Boolean::New(ptr->inheritScale()));
}
开发者ID:Kanma,项目名称:Athena-Entities,代码行数:9,代码来源:Transforms.cpp

示例10: Transforms_SetInheritScale

void Transforms_SetInheritScale(Local<String> property, Local<Value> value, const AccessorInfo& info)
{
    HandleScope handle_scope;

    Transforms* ptr = GetPtr(info.This());
    assert(ptr);

    ptr->setInheritScale(value->BooleanValue());
}
开发者ID:Kanma,项目名称:Athena-Entities,代码行数:9,代码来源:Transforms.cpp

示例11: Transforms_GetOrientation

Handle<Value> Transforms_GetOrientation(Local<String> property, const AccessorInfo &info)
{
    HandleScope handle_scope;

    Transforms* ptr = GetPtr(info.This());
    assert(ptr);

    return handle_scope.Close(toJavaScript(ptr->getOrientation()));
}
开发者ID:Kanma,项目名称:Athena-Entities,代码行数:9,代码来源:Transforms.cpp

示例12: getTransforms

void Transforms::setDirection(const Vector3& vec, tTransformSpace relativeTo,
                              const Vector3& localDirectionVector)
{
    // Do nothing if given a zero vector
    if (vec == Vector3::ZERO)
        return;

    // The direction we want the local direction point to
    Vector3 targetDir = vec.normalisedCopy();

    // Retrieve the parent transforms of this component
    Transforms* pParentTransforms = getTransforms();

    // Transform target direction to world space
    switch (relativeTo)
    {
    case TS_LOCAL:
        targetDir = getWorldOrientation() * targetDir;
        break;

    case TS_PARENT:
        if (m_bInheritOrientation && pParentTransforms)
            targetDir = pParentTransforms->getWorldOrientation() * targetDir;
        break;

    case TS_WORLD:
        // default orientation
        break;
    }

    // Calculate target orientation relative to world space
    Quaternion targetOrientation;

    // Get current local direction relative to world space
    const Quaternion& currentOrient = getWorldOrientation();
    Vector3 currentDir = currentOrient * localDirectionVector;

    if ((currentDir + targetDir).squaredLength() < 0.00005f)
    {
        // Oops, a 180 degree turn (infinite possible rotation axes)
        // Default to yaw i.e. use current UP
        targetOrientation =
            Quaternion(-currentOrient.y, -currentOrient.z, currentOrient.w, currentOrient.x);
    }
    else
    {
        // Derive shortest arc to new direction
        Quaternion rotQuat = currentDir.getRotationTo(targetDir);
        targetOrientation = rotQuat * currentOrient;
    }

    // Set target orientation, transformed to parent space
    if (pParentTransforms && m_bInheritOrientation)
        setOrientation(pParentTransforms->getWorldOrientation().UnitInverse() * targetOrientation);
    else
        setOrientation(targetOrientation);
}
开发者ID:Kanma,项目名称:Athena-Entities,代码行数:57,代码来源:Transforms.cpp

示例13: pop

 void pop()
 {
     assert (individual.size() > 1);
     
     individual.pop_back();
     Transform result = scale(1);
     for (Transforms::reverse_iterator it = individual.rbegin(),
             end = individual.rend(); it != end; ++it)
         result = multiply(result, *it);
     makeCurrent(result);
 }
开发者ID:Leterren,项目名称:gosu,代码行数:11,代码来源:TransformStack.hpp

示例14: Transforms_ResetOrientation

Handle<Value> Transforms_ResetOrientation(const Arguments& args)
{
    HandleScope handle_scope;

    Transforms* ptr = GetPtr(args.This());
    assert(ptr);

    ptr->resetOrientation();

    return Handle<Value>();
}
开发者ID:Kanma,项目名称:Athena-Entities,代码行数:11,代码来源:Transforms.cpp

示例15: clear

 void clear()
 {
     absoluteTransforms.resize(1);
     // Important!! Due to all the swapping, the first entry in the list is not necessarily
     // the base matrix. We need to restore it.
     absoluteTransforms.front() = scale(1);
     individualTransforms.resize(1);
     clipRectStack.clear();
     glBlocks.clear();
     ops.clear();
 }
开发者ID:cajun-code,项目名称:gosu,代码行数:11,代码来源:DrawOpQueue.hpp


注:本文中的Transforms类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。