/// Loads a Power Tab object from an input stream /// @param stream Input stream to load from /// @param version File version /// @return True if the object was loaded, false if not bool PowerTabObject::Deserialize(wxInputStream& stream, wxWord version) { //------Last Checked------// // - Dec 21, 2004 PowerTabInputStream data_stream(stream); return (Deserialize(data_stream, version)); }
data_set::data_set(std::string file_name, int features_size, int tests_size, bool is_class_first) : features_size(features_size), tests_size(tests_size) { answers.resize(tests_size); features.resize(features_size * tests_size); std::ifstream data_stream(file_name); std::string line; for (int i = 0; i < tests_size; i++) { getline(data_stream, line); std::istringstream iss(line); if (is_class_first) { iss >> answers[i]; for (int j = 0; j < features_size; j++) { iss >> features[j * tests_size + i]; } } else { for (int j = 0; j < features_size; j++) { iss >> features[j * tests_size + i]; } iss >> answers[i]; } }
int network_map_decode(Uint8* data, std::map<A,B>* mv) { std::map<A,B> m; // Declare a temporary map std::string datastr = chra(data); // Convert the array to a string if (!datastr.empty()) { // If the string is not empty std::istringstream data_stream (datastr); // Create a stream from the string while (!data_stream.eof()) { // Operate on each line of the stream std::string tmp; getline(data_stream, tmp); // Fetch the line from the stream into a temporary string if ((tmp.empty())||(tmp[0] == '#')) { // If the line is empty or begins with a comment character, then go to the next continue; } std::string ks = tmp.substr(0, tmp.find(" = ")); // Get the key and value pair ks = trim(ks); std::string vs = tmp.substr(tmp.find(" = ")+3); vs = trim(vs); std::istringstream k (ks), v (vs); A key; B value; k >> key; v >> value; m.insert(std::make_pair(key, value)); // Add the pair to the map } }
void SetUp() { // Create mock data_var_context std::fstream data_stream("src/test/test-models/good/variational/hier_logistic.data.R", std::fstream::in); stan::io::dump data_var_context(data_stream); data_stream.close(); model_ = new stan_model(data_var_context, 0, &model_stream_); model_null_stream_ = new stan_model(data_var_context, 0, NULL); base_rng_.seed(0); cont_params_ = Eigen::VectorXd::Zero(model_->num_params_r()); model_stream_.str(""); message_stream_.str(""); parameter_stream_.str(""); diagnostic_stream_.str(""); advi_ = new stan::variational::advi<stan_model, stan::variational::normal_meanfield, rng_t> (*model_, cont_params_, base_rng_, 10, 100, 100, 1); advi_fullrank_ = new stan::variational::advi<stan_model, stan::variational::normal_fullrank, rng_t> (*model_, cont_params_, base_rng_, 10, 100, 100, 1); }
/// Reads the MFC class information for an object from an input stream /// @param stream Input stream to read from /// @param version File version /// @param classId Class id for the object /// @return True if the object's class information was read, false if not bool PowerTabObject::ReadMFCClassInformation(wxInputStream& stream, wxWord version, wxString& classId) { //------Last Checked------// // - Dec 24, 2004 PowerTabInputStream data_stream(stream); return (ReadMFCClassInformation(data_stream, version, classId)); }
// Serialization Functions /// Saves a Power Tab object to an output stream /// @param stream Output stream to save to /// @return True if the object was saved, false if not bool PowerTabObject::Serialize(wxOutputStream& stream) { //------Last Checked------// // - Dec 21, 2004 PowerTabOutputStream data_stream(stream); return (Serialize(data_stream)); }
void ReadDataLabelLibSVM(const std::string& filename, int32_t feature_dim, int32_t num_data, std::vector<std::vector<float> >* features, std::vector<int32_t>* labels, bool feature_one_based, bool label_one_based, bool snappy_compressed) { petuum::HighResolutionTimer read_timer; features->resize(num_data); labels->resize(num_data); std::string file_str = snappy_compressed ? SnappyOpenFileToString(filename) : OpenFileToString(filename); std::istringstream data_stream(file_str); std::vector<int32_t> feature_ids_cache(feature_dim); std::vector<float> feature_vals_cache(feature_dim); int i = 0; for (std::string line; std::getline(data_stream, line) && i < num_data; ++i) { std::vector<int32_t> feature_ids; std::vector<float> feature_vals; int32_t label = ParseLibSVMLine(line, &feature_ids, &feature_vals, feature_one_based, label_one_based, &feature_ids_cache, &feature_vals_cache); (*labels)[i] = label; (*features)[i].resize(feature_dim); for (int j = 0; j < feature_ids.size(); ++j) { (*features)[i][feature_ids[j]] = feature_vals[j]; } } CHECK_EQ(num_data, i) << "Request to read " << num_data << " data instances but only " << i << " found in " << filename; LOG(INFO) << "Read " << i << " instances from " << filename << " in " << read_timer.elapsed() << " seconds."; }
void compress(const uint8_t * const data, size_t data_length) const { if (this->verbose) { LOG(LOG_INFO, "SnappyCompressionOutTransport::compress: data_length=%u", data_length); } BStream data_stream(SNAPPY_COMPRESSION_TRANSPORT_BUFFER_LENGTH); size_t compressed_data_length = data_stream.get_capacity(); uint32_t compressed_data_length_offset = data_stream.get_offset(); data_stream.out_skip_bytes(sizeof(uint16_t)); data_stream.mark_end(); compressed_data_length -= sizeof(uint16_t); snappy_status status = ::snappy_compress( reinterpret_cast<const char *>(data), data_length , reinterpret_cast<char *>(data_stream.end), &compressed_data_length); if (this->verbose & 0x2 || (status != SNAPPY_OK)) { LOG( ((status != SNAPPY_OK) ? LOG_ERR : LOG_INFO) , "SnappyCompressionOutTransport::compress: snappy_compress return %d", status); } if (this->verbose) { LOG(LOG_INFO, "SnappyCompressionOutTransport::compress: compressed_data_length=%u", compressed_data_length); } data_stream.out_skip_bytes(compressed_data_length); data_stream.mark_end(); data_stream.set_out_uint16_le(compressed_data_length, compressed_data_length_offset); this->target_transport.send(data_stream); }
int main(int argc, char **argv) { if (argc < 2) { std::cout << "Usage: ./toAmplDat inputfile" << std::endl; abort(); } std::ifstream data_stream(argv[1]); if (!data_stream){ std::cout << "Error opening input data file. Aborting.\n"; abort(); } std::string key; int value1, value2; double capacity; std::vector<int> sizes; std::vector<int> profits; while (data_stream >> key){ if (key == "CAPACITY") { data_stream >> value1; capacity = value1; } else if (key == "ITEM") {
QString XmlFrameUtil::ConvertDataFormat(const char* data, int len, EEncodeType dst_fmt) { QString ret; if(!data || dst_fmt == eEncode_undef){ return ret; } QByteArray fmt_name; switch(dst_fmt){ case eEncode_utf8: fmt_name = "UTF-8"; break; case eEncode_ascii: fmt_name = "ASCII"; break; default:break; } string tmp(data, len); QString xml_data = QString::fromStdString(tmp); QTextStream data_stream(&xml_data); QTextCodec* codec = QTextCodec::codecForName(fmt_name); if(!codec){ return ret; } data_stream.setCodec(codec); ret = data_stream.readAll(); return ret; }
TEST(ModelUtil, hessian_times_vector) { int dim = 5; Eigen::VectorXd x(dim); Eigen::VectorXd v(dim); double f; Eigen::VectorXd hess_f_dot_v(dim); std::fstream data_stream(std::string("").c_str(), std::fstream::in); stan::io::dump data_var_context(data_stream); data_stream.close(); valid_model_namespace::valid_model valid_model(data_var_context, &std::cout); EXPECT_NO_THROW(stan::model::hessian_times_vector(valid_model, x, v, f, hess_f_dot_v)); EXPECT_FLOAT_EQ(dim, x.size()); EXPECT_FLOAT_EQ(dim, v.size()); EXPECT_FLOAT_EQ(dim, hess_f_dot_v.size()); // Incorporate once operands and partials has been generalized //domain_fail_namespace::domain_fail domain_fail_model(data_var_context, &std::cout); //EXPECT_THROW(stan::model::hessian_times_vector(domain_fail_model, x, v, f, hess_f_dot_v), // std::domain_error); }
TEST(ModelUtil, grad_tr_mat_times_hessian) { int dim = 5; Eigen::VectorXd x(dim); Eigen::MatrixXd X = Eigen::MatrixXd::Identity(dim, dim); Eigen::VectorXd grad_tr_X_hess_f(dim); std::fstream data_stream(std::string("").c_str(), std::fstream::in); stan::io::dump data_var_context(data_stream); data_stream.close(); valid_model_namespace::valid_model valid_model(data_var_context, &std::cout); EXPECT_NO_THROW(stan::model::grad_tr_mat_times_hessian(valid_model, x, X, grad_tr_X_hess_f)); EXPECT_FLOAT_EQ(dim, x.size()); EXPECT_FLOAT_EQ(dim, X.rows()); EXPECT_FLOAT_EQ(dim, X.cols()); EXPECT_FLOAT_EQ(dim, grad_tr_X_hess_f.size()); // Incorporate once operands and partials has been generalized //domain_fail_namespace::domain_fail domain_fail_model(data_var_context, &std::cout); //EXPECT_THROW(stan::model::grad_tr_mat_times_hessian(domain_fail_model, x, X, grad_tr_X_hess_f), // std::domain_error); }
TEST(Services, do_bfgs_optimize__lbfgs) { std::vector<double> cont_vector(2); cont_vector[0] = -1; cont_vector[1] = 1; std::vector<int> disc_vector; static const std::string DATA(""); std::stringstream data_stream(DATA); stan::io::dump dummy_context(data_stream); Model model(dummy_context); typedef stan::optimization::BFGSLineSearch<Model,stan::optimization::LBFGSUpdate<> > Optimizer_LBFGS; Optimizer_LBFGS lbfgs(model, cont_vector, disc_vector, &std::cout); double lp = 0; bool save_iterations = true; int refresh = 0; int return_code; unsigned int random_seed = 0; rng_t base_rng(random_seed); std::fstream* output_stream = 0; mock_callback callback; return_code = stan::services::optimization::do_bfgs_optimize(model, lbfgs, base_rng, lp, cont_vector, disc_vector, output_stream, &std::cout, save_iterations, refresh, callback); EXPECT_FLOAT_EQ(return_code, 0); EXPECT_EQ(35, callback.n); }
TEST(BaseHamiltonian, update) { std::fstream data_stream(std::string("").c_str(), std::fstream::in); stan::io::dump data_var_context(data_stream); data_stream.close(); std::stringstream model_output, metric_output; funnel_model_namespace::funnel_model model(data_var_context, &model_output); stan::mcmc::mock_hamiltonian<funnel_model_namespace::funnel_model, rng_t> metric(model, &metric_output); stan::mcmc::ps_point z(11); z.q.setOnes(); metric.update(z); EXPECT_FLOAT_EQ(10.73223197, z.V); EXPECT_FLOAT_EQ(8.757758279, z.g(0)); for (int i = 1; i < z.q.size(); ++i) EXPECT_FLOAT_EQ(0.1353352832, z.g(i)); EXPECT_EQ("", model_output.str()); EXPECT_EQ("", metric_output.str()); }
TEST(advi_test, hier_logistic_cp_constraint_meanfield) { // Create mock data_var_context std::fstream data_stream("src/test/test-models/good/variational/hier_logistic.data.R", std::fstream::in); stan::io::dump data_var_context(data_stream); data_stream.close(); std::stringstream output; output.clear(); // Instantiate model Model_cp my_model(data_var_context); // RNG rng_t base_rng(0); // Dummy input Eigen::VectorXd cont_params = Eigen::VectorXd::Zero(my_model.num_params_r()); // ADVI stan::variational::advi<Model_cp, stan::variational::normal_meanfield, rng_t> test_advi(my_model, cont_params, base_rng, 10, 100, 100, 1); stan::interface_callbacks::writer::noop_writer writer; test_advi.run(0.01, false, 50, 1, 2e4, writer, writer, writer); }
// MFC Class Functions /// Writes the MFC class information for the object to an output stream /// @param stream Output stream to write to /// @return True if the class information was written, false if not bool PowerTabObject::WriteMFCClassInformation(wxOutputStream& stream) const { //------Last Checked------// // - Dec 24, 2004 PowerTabOutputStream data_stream(stream); return (WriteMFCClassInformation(data_stream)); }
void SetUp() { static const std::string DATA = "mu <- 0.0\ny <- 0\n"; std::stringstream data_stream(DATA); // setup hamiltonian stan::io::dump data_var_context(data_stream); model = new command_model_namespace::command_model(data_var_context); }
ssb_renderer ssb_create_renderer_from_memory(int width, int height, char format, const char* data, char* warning){ try{ std::istringstream data_stream(data); return new Renderer(width, height, format == SSB_BGR ? Renderer::Colorspace::BGR : (format == SSB_BGRX ? Renderer::Colorspace::BGRX : Renderer::Colorspace::BGRA), data_stream, warning != 0); }catch(std::string err){ if(warning) warning[err.copy(warning, SSB_WARNING_LENGTH - 1)] = '\0'; return 0; } }
TEST(StanIoMcmcWriter, write_diagnostic_names) { // Model std::fstream data_stream("", std::fstream::in); stan::io::dump data_var_context(data_stream); data_stream.close(); std::stringstream output; io_example_model_namespace::io_example_model model(data_var_context, &output); // Sample Eigen::VectorXd real(2); real(0) = 1.43; real(1) = 2.71; double log_prob = 3.14; double accept_stat = 0.84; stan::mcmc::sample sample(real, log_prob, accept_stat); // Sampler typedef boost::ecuyer1988 rng_t; rng_t base_rng(0); stan::mcmc::adapt_diag_e_nuts<io_example_model_namespace::io_example_model, rng_t> sampler(model, base_rng, 0, 0); sampler.seed(real); // Writer std::stringstream sample_stream; std::stringstream diagnostic_stream; std::stringstream message_stream; stan::interface::recorder::csv sample_recorder(&sample_stream, "# "); stan::interface::recorder::csv diagnostic_recorder(&diagnostic_stream, "# "); stan::interface::recorder::messages message_recorder(&message_stream, "# "); stan::io::mcmc_writer<io_example_model_namespace::io_example_model, stan::interface::recorder::csv, stan::interface::recorder::csv, stan::interface::recorder::messages> writer(sample_recorder, diagnostic_recorder, message_recorder); writer.write_diagnostic_names(sample, &sampler, model); std::string line; std::getline(diagnostic_stream, line); // FIXME: make this work, too EXPECT_EQ("lp__,accept_stat__,stepsize__,treedepth__,n_leapfrog__,n_divergent__,mu1,mu2,p_mu1,p_mu2,g_mu1,g_mu2", line); EXPECT_EQ("", message_stream.str()); EXPECT_EQ("", output.str()); }
void SetUp() { static const std::string DATA("mu <- 0.0\ny <- 0\n"); std::stringstream data_stream(DATA); // setup hamiltonian stan::io::dump data_var_context(data_stream); model = new command_model_namespace::command_model(data_var_context); debug.str(""); info.str(""); warn.str(""); error.str(""); fatal.str(""); }
void do_recv(char ** pbuffer, size_t len) override { uint8_t * temp_data = reinterpret_cast<uint8_t *>(*pbuffer); size_t temp_data_length = len; while (temp_data_length) { if (this->uncompressed_data_length) { REDASSERT(this->uncompressed_data); const size_t data_length = std::min<size_t>(temp_data_length, this->uncompressed_data_length); ::memcpy(temp_data, this->uncompressed_data, data_length); this->uncompressed_data += data_length; this->uncompressed_data_length -= data_length; temp_data += data_length; temp_data_length -= data_length; } else { BStream data_stream(SNAPPY_COMPRESSION_TRANSPORT_BUFFER_LENGTH); this->source_transport.recv(&data_stream.end, sizeof(uint16_t)); // compressed_data_length(2); const uint16_t compressed_data_length = data_stream.in_uint16_le(); if (this->verbose) { LOG(LOG_INFO, "SnappyCompressionInTransport::do_recv: compressed_data_length=%u", compressed_data_length); } data_stream.reset(); this->source_transport.recv(&data_stream.end, compressed_data_length); this->uncompressed_data = this->uncompressed_data_buffer; this->uncompressed_data_length = sizeof(this->uncompressed_data_buffer); snappy_status status = ::snappy_uncompress( reinterpret_cast<char *>(data_stream.get_data()) , data_stream.size() , reinterpret_cast<char *>(this->uncompressed_data), &this->uncompressed_data_length); if (this->verbose & 0x2 || (status != SNAPPY_OK)) { LOG( ((status != SNAPPY_OK) ? LOG_ERR : LOG_INFO) , "SnappyCompressionInTransport::do_recv: snappy_uncompress return %d", status); } if (this->verbose) { LOG( LOG_INFO, "SnappyCompressionInTransport::do_recv: uncompressed_data_length=%u" , this->uncompressed_data_length); } } } (*pbuffer) = (*pbuffer) + len; }
void qt_gui_settings::post_value_to_core(const QString& _name, const settings_value& _val) const { Ui::gui_coll_helper cl_coll(GetDispatcher()->create_collection(), true); core::ifptr<core::istream> data_stream(cl_coll->create_stream()); if (_val.data_.size()) data_stream->write((const uint8_t*) &_val.data_[0], (uint32_t)_val.data_.size()); cl_coll.set_value_as_qstring("name", _name); cl_coll.set_value_as_stream("value", data_stream.get()); GetDispatcher()->post_message_to_core("settings/value/set", cl_coll.get()); }
TEST(McmcHmcIntegratorsImplLeapfrog, unit_e_energy_conservation) { rng_t base_rng(0); std::fstream data_stream(std::string("").c_str(), std::fstream::in); stan::io::dump data_var_context(data_stream); data_stream.close(); std::stringstream model_output; std::stringstream debug, info, warn, error, fatal; stan::callbacks::stream_logger logger(debug, info, warn, error, fatal); gauss_model_namespace::gauss_model model(data_var_context, &model_output); stan::mcmc::impl_leapfrog< stan::mcmc::unit_e_metric<gauss_model_namespace::gauss_model, rng_t> > integrator; stan::mcmc::unit_e_metric<gauss_model_namespace::gauss_model, rng_t> metric(model); stan::mcmc::unit_e_point z(1); z.q(0) = 1; z.p(0) = 1; metric.init(z, logger); double H0 = metric.H(z); double aveDeltaH = 0; double epsilon = 1e-3; double tau = 6.28318530717959; size_t L = tau / epsilon; for (size_t n = 0; n < L; ++n) { integrator.evolve(z, metric, epsilon, logger); double deltaH = metric.H(z) - H0; aveDeltaH += (deltaH - aveDeltaH) / double(n + 1); } // Average error in Hamiltonian should be O(epsilon^{2}) // in general, smaller for the gauss_model in this case due to cancellations EXPECT_NEAR(aveDeltaH, 0, epsilon * epsilon); EXPECT_EQ("", model_output.str()); EXPECT_EQ("", debug.str()); EXPECT_EQ("", info.str()); EXPECT_EQ("", warn.str()); EXPECT_EQ("", error.str()); EXPECT_EQ("", fatal.str()); }
TEST(ModelUtil, streams) { stan::test::capture_std_streams(); std::fstream data_stream(std::string("").c_str(), std::fstream::in); stan::io::dump data_var_context(data_stream); data_stream.close(); stan_model model(data_var_context, static_cast<std::stringstream*>(0)); std::vector<double> params_r(1); std::vector<int> params_i(0); std::vector<double> gradient; std::stringstream out; try { stan::model::log_prob_propto<true, stan_model>(model, params_r, params_i, 0); stan::model::log_prob_propto<false, stan_model>(model, params_r, params_i, 0); out.str(""); stan::model::log_prob_propto<true, stan_model>(model, params_r, params_i, &out); stan::model::log_prob_propto<false, stan_model>(model, params_r, params_i, &out); EXPECT_EQ("", out.str()); } catch (...) { FAIL() << "log_prob_propto"; } try { Eigen::VectorXd p(1); stan::model::log_prob_propto<true, stan_model>(model, p, 0); stan::model::log_prob_propto<false, stan_model>(model, p, 0); out.str(""); stan::model::log_prob_propto<true, stan_model>(model, p, &out); stan::model::log_prob_propto<false, stan_model>(model, p, &out); EXPECT_EQ("", out.str()); } catch (...) { FAIL() << "log_prob_propto"; } stan::test::reset_std_streams(); EXPECT_EQ("", stan::test::cout_ss.str()); EXPECT_EQ("", stan::test::cerr_ss.str()); }
void ContactAvatarWidget::postSetAvatarToCore(const QPixmap& _avatar) { auto byteArray = processImage(_avatar); core::coll_helper helper(GetDispatcher()->create_collection(), true); core::ifptr<core::istream> data_stream(helper->create_stream()); if (byteArray.size()) data_stream->write((const uint8_t*)byteArray.data(), (uint32_t)byteArray.size()); helper.set_value_as_stream("avatar", data_stream.get()); if (aimid_.isEmpty()) helper.set_value_as_bool("chat", true); else if (aimid_ != MyInfo()->aimId()) helper.set_value_as_string("aimid", aimid_.toStdString()); seq_ = GetDispatcher()->post_message_to_core(qsl("set_avatar"), helper.get()); }
TEST(BaseHamiltonian, streams) { stan::test::capture_std_streams(); std::fstream data_stream(std::string("").c_str(), std::fstream::in); stan::io::dump data_var_context(data_stream); data_stream.close(); EXPECT_NO_THROW(funnel_model_namespace::funnel_model model(data_var_context, 0)); std::stringstream output; EXPECT_NO_THROW(funnel_model_namespace::funnel_model model(data_var_context, &output)); EXPECT_EQ("", output.str()); stan::test::reset_std_streams(); EXPECT_EQ("", stan::test::cout_ss.str()); EXPECT_EQ("", stan::test::cerr_ss.str()); }
// Called by Rocket when a texture is required to be built from an internally-generated sequence of pixels. bool RenderInterfaceOgre3D::GenerateTexture(Rocket::Core::TextureHandle& texture_handle, const Rocket::Core::byte* source, const Rocket::Core::Vector2i& source_dimensions) { static int texture_id = 1; Ogre::DataStreamPtr data_stream(new Ogre::MemoryDataStream((void*) source, source_dimensions.x * source_dimensions.y * sizeof(unsigned int))); Ogre::TexturePtr ogre_texture = Ogre::TextureManager::getSingleton().loadRawData(Rocket::Core::String(16, "%d", texture_id++).CString(), "Rocket", data_stream, source_dimensions.x, source_dimensions.y, Ogre::PF_A8B8G8R8, Ogre::TEX_TYPE_2D, 0); if (ogre_texture.isNull()) return false; texture_handle = reinterpret_cast<Rocket::Core::TextureHandle>(new RocketOgre3DTexture(ogre_texture)); return true; }
VALUE unserialize(VALUE self, VALUE string) { Check_Type(string, T_STRING); QByteArray byte_array(RSTRING_PTR(string), RSTRING_LEN(string)); QDataStream data_stream(byte_array); QVariant variant; data_stream >> variant; // FIXME return a Ruby object for the variant instead of its qDebug QString output; QDebug debug(&output); debug << variant; VALUE result = rb_str_new2(output.toUtf8().data()); rb_enc_associate_index(string, rb_enc_find_index("UTF-8")); return result; }
int BEE::Room::load_instance_map(std::string fname) { if (game->get_is_ready()) { instance_map = fname; game->restart_room(); return 0; } std::vector<std::tuple<Object*,int,int>> data; std::string datastr = file_get_contents(fname); if (!datastr.empty()) { std::istringstream data_stream (datastr); while (!data_stream.eof()) { std::string tmp; getline(data_stream, tmp); if (tmp.empty()) { continue; } std::string v; std::stringstream vs (tmp); getline(vs, v, ','); v = trim(v); std::string d = tmp.substr(tmp.find(",")+1); d = trim(d); int x = std::stoi(d.substr(0, d.find(","))); int y = std::stoi(d.substr(d.find(",")+1)); data.push_back(std::make_tuple(game->get_object_by_name(v), x, y)); } for (auto& i : data) { add_instance(-1, std::get<0>(i), std::get<1>(i), std::get<2>(i)); } } else { std::cerr << "No instances loaded.\n"; return 1; } return 0; }
void EMBOgre::createOgreTexture(EMBFile *file, size_t index) { string ogre_emb_name = name + "_"; string emb_texture_name = file->getName(); if (emb_texture_name.size()) { ogre_emb_name += emb_texture_name; } else { ogre_emb_name += ToString(index); } Ogre::DataStreamPtr data_stream(new EMBOgreDataStream(file)); Ogre::TexturePtr texture = Ogre::TextureManager::getSingleton().createResource(ogre_emb_name, XENOVIEWER_RESOURCE_GROUP).staticCast<Ogre::Texture>(); Ogre::Image image; image.load(data_stream, "DDS"); texture->loadImage(image); ogre_textures[index] = texture; }