void KstBindImage::setMatrix(KJS::ExecState *exec, const KJS::Value& value) { KstMatrixPtr mp = extractMatrix(exec, value); if (mp) { KstImagePtr d = makeImage(_d); if (d) { KstWriteLocker wl(d); d->setMatrix(mp); } } }
KJS::Object KstBindImage::construct(KJS::ExecState *exec, const KJS::List& args) { KstMatrixPtr matrix; if (args.size() > 0) { matrix = extractMatrix(exec, args[0]); if (!matrix) { return createTypeError(exec, 0); } } KstImagePtr image = new KstImage(QString::null, matrix, 10, QColor(0,0,0), 1); KST::dataObjectList.lock().writeLock(); KST::dataObjectList.append(image.data()); KST::dataObjectList.lock().unlock(); return KJS::Object(new KstBindImage(exec, image)); }
//-------------------------------------------------------------- void testApp::update(){ grabber.update(); //sweet - this is how you zoom in zoom += (zoomTarget-zoom) * zoomSpeed; //this is for animation if the model has it. if( bAnimate ){ animationTime += ofGetLastFrameTime(); if( animationTime >= 1.0 ){ animationTime = 0.0; } model.setNormalizedTime(animationTime); mesh = model.getCurrentAnimatedMesh(0); } if (tcpConnected) { //call/response (?) //tcp.send("A"); //sleep? string msg = tcp.receive(); if( msg.length() > 0 ) { debugMessage = "--( " + msg + " ) --"; extractMatrix(msg, &arMatrix); //smoothARMatrix(); } } else //try to reconnect { if (ofGetElapsedTimeMillis() - connectTime > WAIT_TIME) { //ofLog("Trying to connect to host..."); tcpConnected = tcp.setup(HOST_IP, PORT); connectTime = ofGetElapsedTimeMillis(); if (tcpConnected) tcp.send("Phew!"); } } }