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


C++ Tween::getTweenDelta方法代码示例

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


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

示例1: handleRequest

int Worker::handleRequest(queue<double> &inData) {
    double d;
    int status = readDouble(coordSocketFd, d);

    if (status == 0) {
        inData.push(d);
    }

    if (inData.size() >= 3) {
        int frameNumber = (int)inData.front();
        inData.pop();
        int column = (int)inData.front();
        inData.pop();
        int numWorkers = (int)inData.front();
        inData.pop();

        // cerr << "BEFORE " << mView << endl;
        // cerr << "FRAME NUMBER " << frameNumber << endl;

        for (list<Tween*>::iterator it = mTweens.begin(); it != mTweens.end(); it++) {
            Tween* tween = *it;
            tween->init();
            // cerr << "FRAME NUMBER1 " << frameNumber << endl;
                // cerr << "FRAME NUMBER2 " << frameNumber << endl;
            if (tween->type == Tween::TRANSLATE) {
                Vector3D translateDelta = tween->getTweenDelta(frameNumber);
                // cerr << "translateDelta " << translateDelta << endl;
                mEye = mEye + translateDelta;
            } else if (tween->type == Tween::ROTATE) {
                // cerr << "BEFORE " << mView << endl;
                Vector3D rotateDelta = tween->getTweenDelta(frameNumber);
                // cerr << "DELTA " << rotateDelta << endl;
                mView = mView + rotateDelta;
                mSide = mView.cross(mUp);
                // cerr << "AFTER " << mView << endl;
            }
        }


        WorkPool workPool;
        for (int i = column; i < this->width; i += numWorkers) {
            workPool.addJob(i);
        }

        pthread_mutex_t lock;
        pthread_mutex_init(&lock, NULL);

        struct worker_thread_args args;
        args.sendLock = &lock;
        args.workPool = &workPool;
        args.renderer = this->r;
        args.height = this->height;
        args.coordSocketFd = coordSocketFd;

        vector<pthread_t *> workerThreads;

        int numThreads = numCPUs;
        for (int i = 0; i < numThreads; i++) {
            pthread_t *thread = new pthread_t();
            pthread_create(thread, NULL, &testMethod, &args);
            workerThreads.push_back(thread);
        }
        for (int i = 0; i < numThreads; i++) {
            pthread_t *thread = workerThreads[i];
            pthread_join(*thread, NULL);
            delete thread;
        }

        return 1;
    }
    return status;
}
开发者ID:kkevinchou,项目名称:CS488-A5,代码行数:72,代码来源:worker.cpp


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