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


C++ BezierCurve::addControlPoint2d方法代码示例

本文整理汇总了C++中BezierCurve::addControlPoint2d方法的典型用法代码示例。如果您正苦于以下问题:C++ BezierCurve::addControlPoint2d方法的具体用法?C++ BezierCurve::addControlPoint2d怎么用?C++ BezierCurve::addControlPoint2d使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BezierCurve的用法示例。


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

示例1: addAnimation

void Skeleton::addAnimation(const String& name, const String& fileName) {

    OSFILE *inFile = OSBasics::open(fileName.c_str(), "rb");
    
    if(!inFile) {
		return;
	}
	
    unsigned int activeBones,numPoints,numCurves, curveType;
    float length;
    OSBasics::read(&length, 1, sizeof(float), inFile);

    SkeletonAnimation *newAnimation = new SkeletonAnimation(name, length);
    OSBasics::read(&activeBones, sizeof(unsigned int), 1, inFile);
    
    unsigned short boneNameLen;
    char boneNameBuffer[1024];

    for(int j=0; j < activeBones; j++) {
        
        OSBasics::read(&boneNameLen, sizeof(unsigned short), 1, inFile);
        OSBasics::read(boneNameBuffer, 1, boneNameLen, inFile);
        boneNameBuffer[boneNameLen] = '\0';
        
        Bone *trackBone = getBoneByName(boneNameBuffer);
        if(!trackBone) {
            printf("WARNING, INVALID BONE NAME: %s\n", boneNameBuffer);
            continue;
        }
        
        BoneTrack *newTrack = new BoneTrack(trackBone, length);
        
        BezierCurve *curve;
        float vec1[2];
        
        OSBasics::read(&numCurves, sizeof(unsigned int), 1, inFile);
        for(int l=0; l < numCurves; l++) {
            curve = new BezierCurve();
            OSBasics::read(&curveType, sizeof(unsigned int), 1, inFile);
            OSBasics::read(&numPoints, sizeof(unsigned int), 1, inFile);
            
            for(int k=0; k < numPoints; k++) {
                OSBasics::read(vec1, sizeof(float), 2, inFile);					
                curve->addControlPoint2d(vec1[1], vec1[0]);
            }
            switch(curveType) {
                case 0:
                    newTrack->scaleX = curve;
                    break;
                case 1:
                    newTrack->scaleY = curve;
                    break;
                case 2:
                    newTrack->scaleZ = curve;					
                    break;
                case 3:
                    newTrack->QuatW = curve;					
                    break;
                case 4:
                    newTrack->QuatX = curve;					
                    break;
                case 5:
                    newTrack->QuatY = curve;					
                    break;
                case 6:
                    newTrack->QuatZ = curve;					
                    break;
                case 7:;
                    newTrack->LocX = curve;					
                    break;
                case 8:
                    newTrack->LocY = curve;					
                    break;
                case 9:
                    newTrack->LocZ = curve;					
                    break;
            }
        }
        newTrack->initTweens();
        newAnimation->addBoneTrack(newTrack);
    }
    
    animations.push_back(newAnimation);
	OSBasics::close(inFile);	
}
开发者ID:Adnn,项目名称:Polycode,代码行数:85,代码来源:PolySkeleton.cpp


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