void RendererService::updateCamPosition(SharedArray positionValue, SharedArray focalValue, SharedArray viewUpValue) { vtkCamera* camera = m_render->GetActiveCamera(); camera->SetPosition(positionValue.get()); camera->SetFocalPoint(focalValue.get()); camera->SetViewUp(viewUpValue.get()); camera->SetClippingRange(0.1, 1000000); m_interactorManager->getInteractor()->Render(); }
void RendererService::notifyCamPositionUpdated() { vtkCamera* camera = m_render->GetActiveCamera(); SharedArray position = SharedArray(new double[3]); SharedArray focal = SharedArray(new double[3]); SharedArray viewUp = SharedArray(new double[3]); std::copy(camera->GetPosition(), camera->GetPosition()+3, position.get()); std::copy(camera->GetFocalPoint(), camera->GetFocalPoint()+3, focal.get()); std::copy(camera->GetViewUp(), camera->GetViewUp()+3, viewUp.get()); fwServicesBlockAndNotifyMacro( this->getLightID(), m_sigCamUpdated, (position, focal, viewUp), m_slotUpdateCamPosition ); }
bool BspSceneFile::loadBspDirEntry(std::istream& bspStream, const Q3Bsp::DirEntry& entry, SharedArray<uint8_t>::Type& outData) { if (!bspStream.seekg(entry.offset, std::ios::beg)) { return false; } outData.reset(new uint8_t[entry.length]); if (!bspStream.read(reinterpret_cast<char*>(outData.get()), entry.length)) { return false; } return true; }
void basicSample() { poco_assert( UDT_use_count == 0 ); // reality check // test shared_array with a built-in type char * cap = new char [ 100 ]; SharedArray<char> ca ( cap ); poco_assert( ca.get() == cap ); poco_assert( cap == ca.get() ); poco_assert( &ca[0] == cap ); strcpy( ca.get(), "Hot Dog with mustard and relish" ); poco_assert( strcmp( ca.get(), "Hot Dog with mustard and relish" ) == 0 ); poco_assert( strcmp( cap, "Hot Dog with mustard and relish" ) == 0 ); poco_assert( ca[0] == 'H' ); poco_assert( ca[30] == 'h' ); SharedArray<char> ca2 ( ca ); SharedArray<char> ca3 ( ca2 ); ca[0] = 'N'; ca[4] = 'd'; poco_assert( strcmp( ca.get(), "Not dog with mustard and relish" ) == 0 ); poco_assert( strcmp( ca2.get(), "Not dog with mustard and relish" ) == 0 ); poco_assert( strcmp( ca3.get(), "Not dog with mustard and relish" ) == 0 ); ca2.reset(); ca.reset(); poco_assert( ca.get() == 0 ); SharedArray<char> ca4; swap( ca3, ca4 ); poco_assert( strcmp( ca4.get(), "Not dog with mustard and relish" ) == 0 ); poco_assert( ca3.get() == 0 ); std::set< SharedArray<char> > sca; sca.insert(ca4); poco_assert( sca.find(ca4) != sca.end() ); poco_assert( sca.find(ca4) == sca.find( SharedArray<char>(ca4) ) ); // test shared_array with user defined type SharedArray<UDT> udta ( new UDT[3] ); udta[0].value( 111 ); udta[1].value( 222 ); udta[2].value( 333 ); SharedArray<UDT> udta2 ( udta ); poco_assert( udta[0].value() == 111 ); poco_assert( udta[1].value() == 222 ); poco_assert( udta[2].value() == 333 ); poco_assert( udta2[0].value() == 111 ); poco_assert( udta2[1].value() == 222 ); poco_assert( udta2[2].value() == 333 ); udta2.reset(); poco_assert( udta2.get() == 0 ); poco_assert( UDT_use_count == 3 ); // reality check std::cout << "OK\n"; }