void EnergyPlotter::plotData(int limb, const QString& outFilename)
{
	QTextStream& s = openTempFile();
	
	switch (limb)
	{
		case 0: writeThighData   (LeftLeg,  frameInfo()->leftLeg(),  s); break;
		case 1: writeThighData   (RightLeg, frameInfo()->rightLeg(), s); break;
		case 2: writeLowerLegData(LeftLeg,  frameInfo()->leftLeg(),  s); break;
		case 3: writeLowerLegData(RightLeg, frameInfo()->rightLeg(), s); break;
	}
	
	m_limb = limb;
	saveGraph(outFilename);
}
void FftPlotter::aboutToShow()
{
	int min = std::numeric_limits<int>::max();
	int max = std::numeric_limits<int>::min();
	
	filter()->setRootIndex(frameInfo()->index().parent());
	QModelIndex filteredParent(filter()->mapFromSource(frameInfo()->index().parent()));
	int childCount = filter()->rowCount(filteredParent);
	
	for (int i=0 ; i<childCount ; ++i)
	{
		QModelIndex index = filter()->mapToSource(filteredParent.child(i, 0));
		if (!model()->hasModelInformation(index))
			continue;
		min = qMin(min, i);
		max = qMax(max, i);
	}
	
	m_ui.dataSetMin->setRange(min, max);
	m_ui.dataSetMax->setRange(min, max);
}
void EnergyPlotter::replaceTokens(QByteArray& commands)
{
	QString limbName;
	switch (m_limb)
	{
		case 0: limbName = "Left thigh";      break;
		case 1: limbName = "Right thigh";     break;
		case 2: limbName = "Left lower leg";  break;
		case 3: limbName = "Right lower leg"; break;
	}
	
	commands.replace("__LIMB__", limbName.toAscii());
	commands.replace("__VOXEL_FILENAME__", QFileInfo(frameInfo()->fileName()).fileName().toAscii());
}
Example #4
0
    void frameDraw( const eq::uint128_t& )
    {
        applyCamera();
        initializeLivreFrustum();
        requestData();

        const eq::fabric::Viewport& vp = _channel->getViewport( );
        const Viewportf viewport( Vector2f( vp.x, vp.y ),
                                  Vector2f( vp.w, vp.h ));
        _renderViewPtr->setViewport( viewport );

        Viewporti pixelViewport;
        _glWidgetPtr->setViewport( _renderViewPtr.get( ), pixelViewport );

        livre::Node* node = static_cast< livre::Node* >( _channel->getNode( ));
        AvailableSetGenerator generateSet( node->getDashTree( ));

        FrameInfo frameInfo( _currentFrustum );
        generateSet.generateRenderingSet( _currentFrustum,
                                          frameInfo);

        EqRenderViewPtr renderViewPtr =
                boost::static_pointer_cast< EqRenderView >( _renderViewPtr );

        renderViewPtr->setParameters( getFrameData()->getVRParameters( ));

        RayCastRendererPtr renderer =
                boost::static_pointer_cast< RayCastRenderer >(
                    renderViewPtr->getRenderer( ));

        const livre::Pipe* pipe = static_cast< const livre::Pipe* >( _channel->getPipe());
        renderer->initTransferFunction(
                    pipe->getFrameData()->getRenderSettings()->getTransferFunction( ));

        RenderBricks renderBricks;
        generateRenderBricks( frameInfo.renderNodeList,
                              renderBricks );

        renderViewPtr->render( frameInfo,
                               renderBricks,
                               *_glWidgetPtr );
    }
void FftPlotter::plotData(const QString& outFilename)
{
	m_fft->setFrameSet(frameInfo()->index().parent());
	if (m_ui.dataSetAuto->isChecked())
		m_fft->init();
	else
	{
		if (m_ui.dataSetMax->value() - m_ui.dataSetMin->value() <= 0)
		{
			QMessageBox::warning(this, "Invalid data set range", "The maximum must be greater than the minimum");
			return;
		}
		m_fft->init(m_ui.dataSetMin->value(), m_ui.dataSetMax->value());
	}
	
	if (m_ui.leftThighAlpha->isChecked())  runAndPlot(Fft::LeftThighAlpha,  outFilename + "-leftthighalpha");
	if (m_ui.leftThighTheta->isChecked())  runAndPlot(Fft::LeftThighTheta,  outFilename + "-leftthightheta");
	if (m_ui.leftLowerAlpha->isChecked())  runAndPlot(Fft::LeftLowerAlpha,  outFilename + "-leftloweralpha");
	if (m_ui.leftLowerTheta->isChecked())  runAndPlot(Fft::LeftLowerTheta,  outFilename + "-leftlowertheta");
	if (m_ui.rightThighAlpha->isChecked()) runAndPlot(Fft::RightThighAlpha, outFilename + "-rightthighalpha");
	if (m_ui.rightThighTheta->isChecked()) runAndPlot(Fft::RightThighTheta, outFilename + "-rightthightheta");
	if (m_ui.rightLowerAlpha->isChecked()) runAndPlot(Fft::RightLowerAlpha, outFilename + "-rightloweralpha");
	if (m_ui.rightLowerTheta->isChecked()) runAndPlot(Fft::RightLowerTheta, outFilename + "-rightlowertheta");
}
QTextStream& EnergyPlotter::writeLowerLegData(Part part, const Params<float>& initialParams, QTextStream& s)
{
	Params<int> p(ROUND(initialParams.thighAlpha / (ALPHA_STEP == 0 ? 1 : ALPHA_STEP)),
	              ROUND(initialParams.thighTheta / (THETA_STEP == 0 ? 1 : THETA_STEP)),
	              0,
	              0);
	
	for (p.lowerLegAlpha=-ALPHA_RESOLUTION ; p.lowerLegAlpha<=ALPHA_RESOLUTION ; p.lowerLegAlpha++)
	{
		for (p.lowerLegTheta=-THETA_RESOLUTION ; p.lowerLegTheta<=THETA_RESOLUTION ; p.lowerLegTheta++)
		{
			s << float(p.lowerLegTheta) * THETA_STEP << " " << float(p.lowerLegAlpha) * ALPHA_STEP << " " << frameInfo()->result(p, part) << "\n";
		}
		s << "\n";
	}
	
	return s;
}
Example #7
0
int main(int argc, char* argv[])
{
	// initialize Havok internals
	{
		hkMemorySystem::FrameInfo frameInfo(0);

#ifdef _DEBUG
		// (Use debug mem manager to detect mem leaks in Havok code)
		hkMemoryRouter* memoryRouter = hkMemoryInitUtil::initChecking(hkMallocAllocator::m_defaultMallocAllocator, frameInfo);
#else
		hkMemoryRouter* memoryRouter = hkMemoryInitUtil::initFreeListLargeBlock(hkMallocAllocator::m_defaultMallocAllocator, frameInfo);
#endif

		hkBaseSystem::init( memoryRouter, havokErrorReport );

		hkError& errorhandler = hkError::getInstance();
		errorhandler.enableAll();
	}

	if (argc != 2)
	{
		printf("Invalid number of input arguments\n");
		printf("Usage: FBXImport <input_filename>\n");
		return -1;
	}

	// Load FBX and save as HKX
	{
		const char* filename = argv[1];

		FbxManager* fbxSdkManager = FbxManager::Create();
		if( !fbxSdkManager )
		{
			HK_ERROR(0x5213afed, "Unable to create FBX Manager!\n");
			return -1;
		}

		FbxIOSettings* fbxIoSettings = FbxIOSettings::Create(fbxSdkManager, IOSROOT);
		fbxSdkManager->SetIOSettings(fbxIoSettings);

		FbxImporter* fbxImporter = FbxImporter::Create(fbxSdkManager,"");

		if (!fbxImporter->Initialize(filename, -1, fbxSdkManager->GetIOSettings()))
		{
			HK_WARN(0x5216afed, "Failed to initialize the importer! Please ensure file " << filename << " exists\n");
			fbxSdkManager->Destroy();
			return -1;
		}

		FbxScene* fbxScene = FbxScene::Create(fbxSdkManager,"tempScene");
		if (!fbxScene)
		{
			HK_ERROR(0x5216afed, "Failed to create the scene!\n");
			fbxImporter->Destroy();
			fbxSdkManager->Destroy();
			return -1;
		}

		fbxImporter->Import(fbxScene);
		fbxImporter->Destroy();

		// Currently assume that the file is loaded from 3dsmax
		FbxAxisSystem::Max.ConvertScene(fbxScene);

		FbxToHkxConverter::Options options(fbxSdkManager);
		FbxToHkxConverter converter(options);

		if(converter.createScenes(fbxScene))
		{
			int lastSlashIndex = hkString::lastIndexOf(filename,'\\') + 1;
			int extensionIndex = hkString::lastIndexOf(filename,'.');

			hkStringBuf path;
			path.set(filename, lastSlashIndex);

			hkStringBuf name;
			name.set(filename + lastSlashIndex, extensionIndex - lastSlashIndex);

			converter.saveScenes(path, name);
		}
		else
		{
			HK_ERROR(0x0, "Failed to convert the scene!\n");
			fbxSdkManager->Destroy();
			return -1;
		}

		fbxSdkManager->Destroy();
	}

	// quit Havok
	{
		hkBaseSystem::quit();
		hkMemoryInitUtil::quit();
	}
	
	return 0;
}