当前位置: 首页>>代码示例>>C++>>正文


C++ ModelData类代码示例

本文整理汇总了C++中ModelData的典型用法代码示例。如果您正苦于以下问题:C++ ModelData类的具体用法?C++ ModelData怎么用?C++ ModelData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ModelData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: cacheModel

void Renderer::cacheModel(const ModelData& data) {
	for(auto m: models)
		if(data.getName()==m->getName())
			return;

	models.push_back(new StaticModel{data.getName(),data.vertexdata,data.parts});
}
开发者ID:rostj,项目名称:pedantica,代码行数:7,代码来源:renderer.cpp

示例2: ImportModel

recondite::Model* reProjectAssets::ImportModel(const wxString& path) {
	import::ModelImporter modelImporter;
	import::ModelImporterOptions options;
	ModelData modelData;

	int error = modelImporter.ImportModel(path.c_str().AsChar(), modelData, options);

	if (!error) {
		modelData.CalculateBoundings();

		wxFileName modelPath(path);
		wxString modelName = modelPath.GetName();
		WriteModel(modelData, modelName);

		if (modelData.GetLineMeshCount() == 0) {
			CreateSelectionWireframeForModel(modelData);
		}

		recondite::Model* model = _component->GetEngine()->content->Models()->LoadFromData(modelData, modelName.c_str().AsChar());

		wxString modelHandle = GetAssetPath(rAssetType::Model, modelName);
		_manifest.Add(rAssetType::Model, modelName.c_str().AsChar(), modelHandle.c_str().AsChar());

		return model;
	}

	return nullptr;
}
开发者ID:matthewcpp,项目名称:recondite,代码行数:28,代码来源:reProjectAssets.cpp

示例3: debug

void RealTimeStationSearchModelPrivate::slotStationsRegistered(const QString & request,
                                                               const QList<Station> &stations)
{
    if (!requestRunning(request)) {
        return;
    }

    AbstractBackendWrapper *backend = qobject_cast<AbstractBackendWrapper *>(sender());
    if (!backend) {
        return;
    }

    debug("realtime-station-search-model") << "Request" << request << "finished";

    removeRequest(request);

    bool support = backend->capabilities().contains(CAPABILITY_REAL_TIME_RIDES_FROM_STATION);

    ModelDataList addedData;
    foreach (Station station, stations) {
        ModelData data;
        data.insert(Qt::UserRole + STATION_INDEX, QVariant::fromValue(station));
        data.insert(Qt::UserRole + BACKEND_IDENTIFIER_INDEX, backend->identifier());
        data.insert(RealTimeStationSearchModel::NameRole, station.name());
        // TODO ProviderNameRole
        data.insert(RealTimeStationSearchModel::SupportRidesFromStationRole, support);
        addedData.append(data);
    }
开发者ID:SfietKonstantin,项目名称:pt2,代码行数:28,代码来源:realtimestationsearchmodel.cpp

示例4: OnModelResourceLoaded

void reProjectAssets::OnModelResourceLoaded(rEvent& event) {
	rResourceLoadedEvent& resourceLoadedEvent = (rResourceLoadedEvent&)event;
	ModelData* modelData = resourceLoadedEvent.GetModelData();

	if (modelData->GetLineMeshCount() == 0) {
		CreateSelectionWireframeForModel(*modelData);
	}
}
开发者ID:matthewcpp,项目名称:recondite,代码行数:8,代码来源:reProjectAssets.cpp

示例5: ModelData

WizMix::operator ModelData()
{
    int throttleChannel = -1;
    bool isTaranis = IS_TARANIS(GetEepromInterface()->getBoard());

    ModelData model;
    model.used = true;
    model.modelId = modelId;
    model.setDefaultInputs(settings);

    int mixIndex = 0;
    int switchIndex = 0;
    int timerIndex = 0;

    // Safe copy model name
    strncpy(model.name, name, WIZ_MODEL_NAME_LENGTH);
    model.name[WIZ_MODEL_NAME_LENGTH] = 0;

    // Add the channel mixes
    for (int i=0; i<WIZ_MAX_CHANNELS; i++ )
    {
        Channel ch = channel[i];
        if (ch.input1 == THROTTLE_INPUT || ch.input2 == THROTTLE_INPUT)
            throttleChannel = i;

        addMix(model, ch.input1, ch.weight1, i, mixIndex);
        addMix(model, ch.input2, ch.weight2, i, mixIndex);
    }

    // Add the Throttle Cut option
    if( options[THROTTLE_CUT_OPTION] && throttleChannel >=0 ) {
        model.funcSw[switchIndex].swtch.type = SWITCH_TYPE_SWITCH;
        model.funcSw[switchIndex].swtch.index = isTaranis ? SWITCH_SF0 : SWITCH_THR;
        model.funcSw[switchIndex].enabled = 1;
        model.funcSw[switchIndex].func = (AssignFunc)throttleChannel;
        model.funcSw[switchIndex].param = -100;
    }

    // Add the Flight Timer option
    if (options[FLIGHT_TIMER_OPTION] ) {
        model.timers[timerIndex].mode.type = SWITCH_TYPE_TIMER_MODE;
        model.timers[timerIndex].mode.index = TMRMODE_THR_TRG;
        timerIndex++;
    }

    // Add the Throttle Timer option
    if (options[THROTTLE_TIMER_OPTION] && throttleChannel >=0) {
        model.timers[timerIndex].mode.type = SWITCH_TYPE_TIMER_MODE;
        model.timers[timerIndex].mode.index = TMRMODE_THR;
        timerIndex++;
    }

    return model;
}
开发者ID:Paul-NA8E,项目名称:opentx,代码行数:54,代码来源:wizarddata.cpp

示例6: CreateScreen

void CreateScreen(
	ModelData&								ScreenMesh)
{
	MeshData Screen;
	AttribData<vec3> Screen_vert;
	Screen_vert.Resize(4);
	Screen_vert.Set(0, vec3(-1.0f,  1.0f, 1.0f));	//	lu-corner
	Screen_vert.Set(1, vec3( 1.0f,  1.0f, 1.0f));	//	ru-corner
	Screen_vert.Set(2, vec3(-1.0f, -1.0f, 1.0f));	//	bl-corner
	Screen_vert.Set(3, vec3( 1.0f, -1.0f, 1.0f));	//	br-corner

	AttribData<vec2> Screen_UVs;
	Screen_UVs.Resize(4);
	Screen_UVs.Set(0, vec2(0.0f, 0.0f));
	Screen_UVs.Set(1, vec2(0.0f, 1.0f));
	Screen_UVs.Set(2, vec2(1.0f, 0.0f));
	Screen_UVs.Set(3, vec2(1.0f, 1.0f));

	AttribData<GLFace16> Screen_face;
	Screen_face.Resize(2);
	Screen_face.Set(0, GLFace16(0, 1, 2));
	Screen_face.Set(1, GLFace16(1, 3, 2));

	Polygons polys;
	polys.SetFaces(Screen_face);
	polys.SetMaterial(0);

	AttribData<Polygons> polygons;
	polygons.Resize(1);
	polygons.Set(0, polys);

	Screen.SetName("Screen");
	Screen.SetVertexArray(Screen_vert);
	Screen.SetUVArray(Screen_UVs);
	Screen.SetPolygonList(polygons);
	Screen.GenerateNormals(false);
	Screen.GenerateTangents();

	MaterialData Screen_mat;
	Screen_mat.MaterialType = HasRenderedTexture;

	Library<MaterialData> lib_mat;
	lib_mat.Resize(1);
	lib_mat.Set(0, Screen_mat);

	Library<MeshData> lib_mesh;
	lib_mesh.Resize(1);
	lib_mesh.Set(0, Screen);
	
	ScreenMesh.SetMeshData(lib_mesh);
	ScreenMesh.SetMaterialData(lib_mat);
}
开发者ID:TimelessVisions,项目名称:GLEngine,代码行数:52,代码来源:GLData.cpp

示例7: loadModel

bool OpenTxEepromInterface::loadModel(ModelData &model, uint8_t *data, int index, unsigned int stickMode)
{
  T _model;
  
  if (!data) {
    // load from EEPROM
    efile->openRd(FILE_MODEL(index));
    int sz = efile->readRlc2((uint8_t*)&_model, sizeof(T));
    if (sz) {
      model = _model;
      if (sz < (int)sizeof(T)) {
        std::cout << " size(" << model.name << ") " << sz << " < " << (int)sizeof(T) << " ";
      }
      if (stickMode) {
        applyStickModeToModel(model, stickMode);
      }
    }
    else {
      model.clear();
    }
  }
  else {
    // load from SD Backup, size is stored in index
    if ((unsigned int)index < sizeof(T))
      return false;
    memcpy((uint8_t*)&_model, data, sizeof(T));
    model = _model;
  }

  return true;
}
开发者ID:TimGFoley,项目名称:opentx,代码行数:31,代码来源:opentxinterface.cpp

示例8: open9xModel

bool OpenTxEepromInterface::loadModelVariant(unsigned int index, ModelData &model, uint8_t *data, unsigned int version, unsigned int variant)
{
  T open9xModel(model, board, version, variant);

  if (!data) {
    // load from EEPROM
    QByteArray eepromData(sizeof(model), 0);  // ModelData should be always bigger than the EEPROM struct
    efile->openRd(FILE_MODEL(index));
    int numbytes = efile->readRlc2((uint8_t *)eepromData.data(), eepromData.size());
    if (numbytes) {
      open9xModel.Import(eepromData);
      // open9xModel.Dump();
      model.used = true;
    }
    else {
      model.clear();
    }
  }
  else {
    // load from SD Backup, size is stored in index
    QByteArray eepromData((char *)data, index);
    open9xModel.Import(eepromData);
  }

  return true;
}
开发者ID:TimGFoley,项目名称:opentx,代码行数:26,代码来源:opentxinterface.cpp

示例9: DALI_ASSERT_DEBUG

void ResourceThreadModel::Load(const ResourceRequest& request)
{
  DALI_ASSERT_DEBUG(request.GetType()->id == ResourceModel);

  DALI_LOG_INFO(mLogFilter, Debug::Verbose, "%s(%s)\n", __PRETTY_FUNCTION__, request.GetPath().c_str());

  scoped_ptr<ModelBuilder> modelBuilder( CreateModelBuilder(request.GetPath()) );

  ModelData modelData = ModelData::New(modelBuilder->GetModelName());

  const bool success =  modelBuilder->Build(modelData);

  if( success )
  {
    // Construct LoadedResource and ResourcePointer for model data
    LoadedResource resource( request.GetId(), request.GetType()->id, ResourcePointer(&(modelData.GetBaseObject())));

    // Queue the loaded resource
    mResourceLoader.AddLoadedResource(resource);
  }
  else
  {
    // add to the failed queue
    FailedResource resource(request.GetId(), FailureUnknown);
    mResourceLoader.AddFailedLoad(resource);
  }
}
开发者ID:Tarnyko,项目名称:dali-adaptor,代码行数:27,代码来源:resource-thread-model.cpp

示例10: main

int main(int argc, char* argv[])
{
    LoaderObj *loader = new LoaderObj();
    loader->loadFile("test.obj");
    ModelData data;
    loader->cloneData(data);
	delete loader;

    Encoder *encoder = new Encoder();
    // FIXME: set data should clone, but here is not.
    encoder->setData(data); 
    encoder->saveFile("test.objc");

	data.dispose();
	
	return 0;
}
开发者ID:suyu0925,项目名称:backup,代码行数:17,代码来源:ObjcConverter.cpp

示例11:

	Model::Model(ModelData & _data) :
		UsingShader(&ResMgr::loadShader(simpleShaderName, shaderSrcs::model_Vertex, shaderSrcs::model_Fragment, Shader::FromString), &ResMgr::loadShader(lightShaderName, shaderSrcs::model_LightVertex, shaderSrcs::model_LightFragment, Shader::FromString)),
		m_modelData(&_data),
		m_vaos(_data.getMeshes().size()),
		m_color(Color::Black),
		m_useColorOnly(false)
	{
		setUp();
	}
开发者ID:Crisspl,项目名称:FHL-plus-EndlessRunnerGame,代码行数:9,代码来源:Model.cpp

示例12: ModelViewerController

void ModelViewerModule::Init(const rArrayString& args) {
	auto createControllerFunc = [&](const rString& name, rEngine* engine, ruiDocument* document) {
		return new ModelViewerController(_skeletonGeometry.get(), name, engine, document);
	};

	auto deleteControllerFunc = [](ruiController* controller) {
		delete controller;
	};

	_engine->ui->RegisterControllerClass("ModelViewerController", createControllerFunc, deleteControllerFunc);
	Model* model = nullptr;

	rString file, archive;
	ParseArgs(args, file, archive);

	if (!archive.empty()) {
		_engine->resources->OpenArchive(archive);
		model = _engine->content->Models()->LoadFromResource(file, "model");
	}
	else {
		auto fileSystemRef = _engine->filesystem->OpenReadFileRef(file);
		ModelData modelData;
		modelData.Read(*fileSystemRef);

		_engine->filesystem->CloseReadFileRef(fileSystemRef);

		model = _engine->content->Models()->LoadFromData(modelData, "model");
	}

	if (model->GetSkeleton()) {
		rPawn* pawn = new rPawn(model, "model", _engine);
		_skeletonGeometry.reset(new SkeletonGeometry(_engine, pawn));
		_engine->scene->AddActor(pawn);
	}
	else {
		rProp* prop = new rProp(model, "model", _engine);
		_engine->scene->AddActor(prop);
	}
	
	rViewport* mainViewport = CreateView(model, _engine);

	_engine->ui->LoadUiDocument("C:/development/recondite/samples/modelviewer/modelviewer/modelviewer.xml", mainViewport);

}
开发者ID:matthewcpp,项目名称:recondite,代码行数:44,代码来源:ModelViewerModule.cpp

示例13: glGetAttribLocation

//==============================================================================
// Loads Model Data into OpenGL and Stores Handles in Static Variables
//==============================================================================
void Tree::loadResources() {

	shaderProgram = ShaderUtil::createProgram("Tree", std::vector < GLenum > {GL_VERTEX_SHADER, GL_FRAGMENT_SHADER}, true);

	sPositionHandle = glGetAttribLocation(shaderProgram, "iPosition");
	sNormalHandle = glGetAttribLocation(shaderProgram, "iNormal");
	sSunHandle = glGetUniformLocation(shaderProgram, "uSunDirection");
	sMVPHandle = glGetUniformLocation(shaderProgram, "uMVP");
	sNormalMatrixHandle = glGetUniformLocation(shaderProgram, "uNormalMatrix");

	ModelData data = ShaderUtil::loadModel("tree");

	verticesVBO = data.getVerticesVBO();
	normalsVBO = data.getNormalsVBO();
	vertCount = data.getVertCount();

	glGenVertexArrays(1, &VAO);
	glBindVertexArray(VAO);

	glUseProgram(shaderProgram);

	//------------------------------------------------------------------------------
	// Load Vertex Data
	//------------------------------------------------------------------------------
	glBindBuffer(GL_ARRAY_BUFFER, verticesVBO);
	glEnableVertexAttribArray(sPositionHandle);
	glVertexAttribPointer(sPositionHandle, 3, GL_FLOAT, GL_FALSE, 0, NULL);

	//------------------------------------------------------------------------------
	// Load Normal Data
	//------------------------------------------------------------------------------
	glBindBuffer(GL_ARRAY_BUFFER, normalsVBO);
	glEnableVertexAttribArray(sNormalHandle);
	glVertexAttribPointer(sNormalHandle, 3, GL_FLOAT, GL_FALSE, 0, NULL);

	glUseProgram(0);
	glBindVertexArray(0);
	glBindBuffer(GL_ARRAY_BUFFER, 0);
}
开发者ID:BarstoolStudios,项目名称:Settlement,代码行数:42,代码来源:Tree.cpp

示例14: ModelData

ModelData* ModelComponent::getModelData(){
    ModelData *md = new ModelData();
    std::map<char,std::vector<QString>* > numbers;

    for(std::map<char, QLineEdit*>::iterator i = components.begin(); i != components.end(); i++){

        QString txt = i->second->text();
        int count = 0;

        std::vector<QString> *vecString = new std::vector<QString>();
        vecString->push_back("");
        numbers[i->first] = vecString;

        QString::iterator j = txt.begin();

        for(QString::iterator j = txt.begin(); j != txt.end(); j++){

            if(((*j) >= '0' && (*j) <= '9') || (*j) == ',' || (*j) == '.' || (*j)=='-'){ //ten warunek mozna poprawic(chodzi o wystapienie dwoch kropek albo minusow
                vecString->at(count).push_back( (*j));
            }else if((*j) == 32){
                    count++;
                    vecString->push_back("");
            }else{
                break;
                //TODO throw execption
            }
        }

        if(vecString->back() == "" ){
            vecString->pop_back();
        }
    }

    std::vector<QString>* A = numbers.at('A');
    std::vector<double> Adouble;

    for(std::vector<QString>::iterator i = A->begin(); i != A->end(); i++){
        Adouble.push_back((*i).toDouble());
    }
    md->setA(Adouble);

    std::vector<QString>* B = numbers.at('B');
    std::vector<double> Bdouble;
    for(std::vector<QString>::iterator i = B->begin(); i != B->end(); i++){
        Bdouble.push_back((*i).toDouble());
    }
    md->setB(Bdouble);

    std::vector<QString>* k = numbers.at('k');
    md->setK(k->at(0).toDouble());

    std::vector<QString>* t = numbers.at('t');
    md->setT(t->at(0).toDouble());

    std::vector<QString>* nr = numbers.at('nr');
    md->setNoiseRatio(nr->at(0).toDouble());
    return md;
}
开发者ID:jakubbialas,项目名称:PSS_lab,代码行数:58,代码来源:modelcomponent.cpp

示例15: sizeof

void Gruvin9xInterface::loadModel(ModelData &model, unsigned int stickMode, int version)
{
  T _model;
  if ((version == 2 && efile->readRlc2((uint8_t*)&_model, sizeof(T))) ||
      (version == 1 && efile->readRlc1((uint8_t*)&_model, sizeof(T)))) {
    model = _model;
    if (stickMode) {
      applyStickModeToModel(model, stickMode);
    }
  }
  else {
    model.clear();
  }
}
开发者ID:BenZoFly,项目名称:opentx,代码行数:14,代码来源:gruvin9xinterface.cpp


注:本文中的ModelData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。