Пример #1
0
MeshModel* Loader_3DS::load(const std::string& filename, const Transform& t, int hint)
{
	conv_tform = t;
	conv = flip_tris = false;
	if (conv_tform != Transform()) {
		conv = true;
		if (conv_tform.m.i.cross(conv_tform.m.j).dot(conv_tform.m.k) < 0)
			flip_tris = true;
	}

	collapse = !!(hint & MeshLoader::HINT_COLLAPSE);
	animonly = !!(hint & MeshLoader::HINT_ANIMONLY);

	if (!in.open(filename.c_str(), std::ios_base::in | std::ios_base::binary)) {
		return 0;
	}

	MeshModel* root = parseFile();
	in.close();

	materials_map.clear();
	name_map.clear();
	id_map.clear();

	return root;
}
Пример #2
0
        void pluginLoad() {
            if(notifyPeriod != 0) {
                Environment<>::get().PluginConnector().setNotificationPeriod(this, notifyPeriod);

                // Set default resources to log
                if (properties.empty()) {
                    properties.push_back("rank");
                    properties.push_back("position");
                    properties.push_back("currentStep");
                    properties.push_back("cellCount");
                    properties.push_back("particleCount");
                    propertyMap["rank"] = true;
                    propertyMap["position"] = true;
                    propertyMap["currentStep"] = true;
                    propertyMap["particleCount"] = true;
                    propertyMap["cellCount"] = true;
                }
                else {
                    for (size_t i = 0; i < properties.size(); ++i) {
                        propertyMap[properties[i]] = true;
                    }
                }

                // Prepare file for output stream
                if (streamType == "file") {
                    size_t rank = static_cast<size_t>(Environment<simDim>::get().GridController().getGlobalRank());
                    std::stringstream ss;
                    ss << outputFilePrefix << rank;
                    boost::filesystem::path resourceLogPath(ss.str());
                    fileBuf.open(resourceLogPath.string().c_str(), std::ios::out);
                }
            }
        }
Пример #3
0
boost::filesystem::path Appender::DoOpen(std::filebuf &file, Path& path)
{
    const boost::filesystem::path PATH(SelectPathToUseHideErrors(path));
    CreateDirectoryTree(PATH.branch_path( ));
    using namespace std;
    file.open(PATH.string( ).c_str( ), ios::out | ios::app | ios::ate);

    return PATH;
}
void ImageFileRecorder::start()
{
	if ( !m_running )
	{
		filebuffer.open ( m_logfile.string().c_str(), std::ios::out );
		if( !filebuffer.is_open()  )
			UBITRACK_THROW( "Error opening file" );
			
		m_running = true;
	}
}