• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ LoadModel函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Initialize

bool Model::Initialize(
    const ModelType& modelDesc,
    ComPtr<ID3D11Device> const device,
    const void* shaderBCode,
    const size_t bcodeLength,
    const std::shared_ptr<MaterialFactory> materialFactory)
{
    dimensions = {};
    initDimensions = {};

    if (!LoadModel(modelDesc.modelFilename, device, shaderBCode, bcodeLength))
    {
        return false;
    }

    material = materialFactory->getMaterial(device, modelDesc.materialFilename);
    if (!material) return false;

    return true;
}
开发者ID:AlexKoukoulas2074245K,项目名称:Arkanoid,代码行数:20,代码来源:modelclass.cpp


示例2: LoadModel

/*
================
idClipModel::idClipModel
================
*/
idClipModel::idClipModel( const idClipModel *model ) {
	enabled = model->enabled;
	entity = model->entity;
	id = model->id;
	owner = model->owner;
	origin = model->origin;
	axis = model->axis;
	bounds = model->bounds;
	absBounds = model->absBounds;
	material = model->material;
	contents = model->contents;
	collisionModelHandle = model->collisionModelHandle;
	traceModelIndex = -1;
	if ( model->traceModelIndex != -1 ) {
		LoadModel( *GetCachedTraceModel( model->traceModelIndex ) );
	}
	renderModelHandle = model->renderModelHandle;
	clipLinks = NULL;
	touchCount = -1;
}
开发者ID:tankorsmash,项目名称:quadcow,代码行数:25,代码来源:Clip.cpp


示例3: SpawnPlayer

void SpawnPlayer(float x,float y,float z)
{
  

  entity *testmap;
  
  testmap = newentity();
  testmap->model = LoadModel("models/ship.obj", 0,0.4f);
  if(testmap->model != NULL)
    testmap->shown = 1;
  else testmap->shown = 0;

  testmap->texture = LoadModelTexture("models/ship.png",256,256);
  testmap->self = testmap;
  testmap->shown = 1;
  testmap->alpha = 255;
  testmap->sprite_model = 2;
  testmap->scale.x = 1.0f;
  testmap->scale.y = 1.0f;
  testmap->scale.z = 1.0f;
  testmap->s.x = x;
  testmap->s.y = y;
  testmap->s.z = z;
  testmap->v.x = 1;
  testmap->box.x = testmap->model->center[0];
  testmap->box.y = testmap->model->center[1];
  testmap->box.z = testmap->model->center[2];
  testmap->box.w = testmap->model->dimensions[0];
  testmap->box.h = testmap->model->dimensions[1];
  testmap->box.d = testmap->model->dimensions[2];
  testmap->state=0;
  testmap->think = tileThink;
  testmap->touch = PlayerTouch;
  testmap->frame=0;
  testmap->health=1;
  testmap->solid=1;
  testmap->totalframes=10;
  testmap->keyframe=0;
  testmap->nextkeyframe=1;
  playdead=0;
}
开发者ID:anthonyrego,项目名称:ShapeShifter,代码行数:41,代码来源:map.c


示例4: LoadModel

bool ModelClass::Initialize(ID3D10Device* device, char* modelFilename)
{
    bool result;


    // Load in the model data.
    result = LoadModel(modelFilename);
    if(!result)
    {
        return false;
    }

    // Initialize the vertex and index buffer that hold the geometry for the model.
    result = InitializeBuffers(device);
    if(!result)
    {
        return false;
    }

    return true;
}
开发者ID:jiangguang5201314,项目名称:ZNginx,代码行数:21,代码来源:modelclass.cpp


示例5: LoadModel

void CRichModel::Preprocess()
{
    if (fBePreprocessed)
        return;
    if (!m_fBeLoaded)
    {
        LoadModel();
    }

    if (!fLocked)
    {
        fLocked = true;
        CreateEdgesFromVertsAndFaces();
        CollectAndArrangeNeighs();
        ComputeNumOfHoles();
        ComputeAnglesAroundVerts();
        ComputePlanarCoordsOfIncidentVertForEdges();
        fBePreprocessed = true;
        fLocked = false;
    }
}
开发者ID:wxnfifth,项目名称:DGG_project,代码行数:21,代码来源:RichModel.cpp


示例6: LoadModelPlus

Model* LoadModelPlus(const char* name/*,
			GLuint program,
			char* vertexVariableName,
			char* normalVariableName,
			char* texCoordVariableName*/)
{
	Model *m;
	
	m = LoadModel(name);
	
	glGenVertexArrays(1, &m->vao);
	glGenBuffers(1, &m->vb);
	glGenBuffers(1, &m->ib);
	glGenBuffers(1, &m->nb);
	if (m->texCoordArray != NULL)
		glGenBuffers(1, &m->tb);
		
	ReloadModelData(m);
	
	return m;
}
开发者ID:AnotherHermit,项目名称:TSBK03,代码行数:21,代码来源:loadobj.c


示例7: LoadModel

	void CoreDelegateImpl::OnCreate()
	{
		Core::GetGlobalObject<InputSystem>()->AddSubscriber(&m_input_subs);
		Core::GetGlobalObject<InputSystem>()->AddSubscriber(&g_camera_controller);
		auto p_load_manager = Core::GetGlobalObject<Resources::ResourceManager>();
		p_load_manager->LoadResourceSet("..\\..\\..\\Samples\\Resources\\ResourceSets\\render_testing.res");

		LoadModel();		
		CreateMesh();
		Core::GetGlobalObject<Render::FontManager>()->LoadFont("Arial", Render::FontSettings(), "..\\..\\..\\Samples\\Resources\\Fonts\\arial.ttf");
		auto& world = Core::GetApplication()->GetWorld();
		auto& camera = world.GetCamera();
		static SDK::Vector3 shift{ 5.f, -5.f, -50.f };
		static SDK::Vector3 look_at{ -500,-500, 1500 };
		camera.LookAt(shift, look_at);

		world.GetFrustum().SetFOV(80 * Math::DEG2RAD);
		world.GetFrustum().SetFarClipDistance(1000.f);
		world.GetFrustum().SetNearClipDistance(0.5f);
		Core::GetRenderer()->SetClearColor(Color(128, 112, 112, 255));
	}
开发者ID:TraurigeNarr,项目名称:SupportSDK,代码行数:21,代码来源:CoreDelegateImpl.cpp


示例8: SpawnMine

void SpawnMine(float x,float y,float z, float vx, float vy, float vz, float side)
{
  

  entity *testmap;
  
  testmap = newentity();
  testmap->model = LoadModel("models/mine.obj", 0,1.0f);
  if(testmap->model != NULL)
    testmap->shown = 1;
  else testmap->shown = 0;

  testmap->texture = LoadModelTexture("models/mine.png",256,256);
  testmap->self = testmap;
  testmap->shown = 1;
  testmap->alpha = 255;
  testmap->sprite_model = 4;
  testmap->scale.x = 1.0f;
  testmap->scale.y = 1.0f;
  testmap->scale.z = 1.0f;
  testmap->s.x = x;
  testmap->s.y = y;
  testmap->s.z = z;
  testmap->v.x = vx;
  testmap->v.y = vy;
  testmap->v.z = vz;
  testmap->state=side;
  testmap->box.x = testmap->model->center[0];
  testmap->box.y = testmap->model->center[1];
  testmap->box.z = testmap->model->center[2];
  testmap->box.w = testmap->model->dimensions[0];
  testmap->box.h = testmap->model->dimensions[1];
  testmap->box.d = testmap->model->dimensions[2];
  testmap->think = mineThink;
  testmap->frame=0;
  testmap->solid=1;
  testmap->totalframes=10;
  testmap->keyframe=0;
  testmap->nextkeyframe=1;
}
开发者ID:anthonyrego,项目名称:ShapeShifter,代码行数:40,代码来源:map.c


示例9: Lib3dsModel

BulletModel::BulletModel(glm::vec3 dir) : Lib3dsModel(), mAge(0)
{
	SetPhysicsType(Model::Dynamic);
	SetScaling(glm::vec3(0.5, 0.5, 0.5));

	mDirection = glm::normalize(dir);

	float verticalAngle = -glm::asin(mDirection.y); // approximately good
	float horizontalAngle = -((-3.14159 / 2.0) + glm::atan(mDirection.z / mDirection.x));

	// ATAN2
	if (mDirection.x < 0){
		if (mDirection.z >= 0){
			horizontalAngle -= 3.14159;
		}
		else{
			horizontalAngle += 3.14159;
		}
	}

	//std::cout << "Bullet model vAngle: " << verticalAngle << " hAngle " << horizontalAngle  << " x:  " << direction.x << " z: " << direction.z << std::endl;

	q3Quaternion rot_vert( q3Vec3(1,0,0), verticalAngle);
	q3Quaternion rot_horiz(q3Vec3(0,1,0), horizontalAngle);

	mRotation = rot_horiz * rot_vert;

	mScaling = glm::vec3(0.01, 0.01, 0.01);
	mMeshes.insert(13);
	mFileName = "../Assets/Objects/bombs.3ds";

	LoadModel();



	//mMaxAge = 90; // 90 second exipr date

}
开发者ID:Phohawkenics,项目名称:COMP371-Computer-Graphics-2015,代码行数:38,代码来源:BulletModel.cpp


示例10: strncpy

void Game::processMapFileLine(string line)	{

	char* token;
	char str[512];

	strncpy(str, line.c_str(), 512);
	token = strtok(str, WHITESPACE);

	if( token == NULL )
		return;

	if( !strcmp(token, "map") )	{
		token = strtok(NULL, WHITESPACE);
		LoadMap(token);
		Con_print("MAP: Loading OBJ Map: %s", token);
	}
	else if( !strcmp(token, "md2") )	{
		token = strtok(NULL, WHITESPACE);
		LoadModel(token);
		Con_print("MAP: Loading MD2 Model: %s", token);
	}

}
开发者ID:nonsensicalthinking,项目名称:rendar,代码行数:23,代码来源:Game.cpp


示例11: LoadAssets

bool LoadAssets()
{
	// 텍스처 로딩
	gpStoneDM = LoadTexture("Fieldstone_DM.tga");
	if (!gpStoneDM)
	{
		return false;
	}

	gpStoneSM = LoadTexture("Fieldstone_SM.tga");
	if (!gpStoneSM)
	{
		return false;
	}

	gpStoneNM = LoadTexture("Fieldstone_NM.tga");
	if (!gpStoneNM)
	{
		return false;
	}

	// 쉐이더 로딩
	gpNormalMappingShader = LoadShader("NormalMapping.fx");
	if (!gpNormalMappingShader)
	{
		return false;
	}

	// 모델 로딩
	gpSphere = LoadModel("spherewithtangent.x");
	if (!gpSphere)
	{
		return false;
	}

	return true;
}
开发者ID:popekim,项目名称:ShaderPrimerKR,代码行数:37,代码来源:ShaderFramework.cpp


示例12: playergraphic

void playergraphic(float x,float y,float z)
{

  entity *player;
  
  player = newentity();
  player->model = LoadModel(playerModel, 3,playerModelScale);
  if(player->model != NULL)
    player->shown = 1;
  else player->shown = 0;

  player->shaderTexture = loadShader("Shader.txt");
  player->self = player;
  player->sprite_model = 7;
  player->scale.x = 8.0f;
  player->scale.y = 8.0f;
  player->scale.z = 8.0f;
  player->modelColor[0] = playerColor.x;
  player->modelColor[1] = playerColor.y;
  player->modelColor[2] = playerColor.z;
  player->modelColor[3] = 1.0f;
  player->s.x = x;
  player->s.y = y;
  player->s.z = z;
  player->think=graplayerupdate;

  player->frame=0;
  player->totalframes=10;
  player->keyframe=0;
  player->nextkeyframe=0;
  player->rotation.x=0.0f;
  player->rotation.y=0.0f;
  player->rotation.z=0.0f;


}
开发者ID:anthonyrego,项目名称:ShapeShifter,代码行数:36,代码来源:level.c


示例13: LoadModel

bool StaticMeshComponent::Initialise(ID3D11Device* device, char* modelFilename, WCHAR* textureFilename)
{
	bool result;
	
	result = LoadModel(modelFilename);
	if (!result)
	{
		return false;
	}

	result = InitialiseBuffers(device);
	if (!result)
	{
		return false;
	}

	result = LoadTexture(device, textureFilename);
	if (!result)
	{
		return false;
	}

	return true;
}
开发者ID:AkselS,项目名称:The-Lab,代码行数:24,代码来源:StaticMeshComponent.cpp


示例14: LoadModel

void Pong::LoadAssets(void)
{
	std::cout << "\nLoading Assets..." << std::endl;
	LoadModel("Assets/Meshes/Cube.obj");
	LoadModel("Assets/Meshes/Paddle.obj");
	LoadModel("Assets/Meshes/WorldBounds.obj");
	LoadModel("Assets/Meshes/Skybox.obj");
	LoadModel("Assets/Meshes/Horse.obj");
	LoadModel("Assets/Meshes/Elephant.obj");
	
	gameObjectRegister.push_back(new Ball(modelRegister[0], "Assets/Textures/WhiteTexture.bmp"));
	gameObjectRegister.push_back(new Paddle(glm::vec3(-25.0f, 0.0f, 0.0f), modelRegister[1], "Assets/Textures/WhiteTexture.bmp"));
	gameObjectRegister.push_back(new Paddle(glm::vec3(25.0f, 0.0f, 0.0f), modelRegister[1], "Assets/Textures/WhiteTexture.bmp"));
	gameObjectRegister.push_back(new WorldBounds(modelRegister[2], "Assets/Textures/WhiteTexture.bmp"));
	gameObjectRegister.push_back(new GUI(glm::vec3(0.0f, 25.0f, 0.0f), modelRegister[0], "Assets/Textures/WhiteTexture.bmp"));
	gameObjectRegister.push_back(new Skybox(modelRegister[0], "Assets/Textures/BlackTexture.bmp"));
	std::cout << "Assets Loaded OK!" << std::endl;

	std::cout << "\nInitialising Vertex Arrays and Buffers..." << std::endl;
	for (int i = 0; i < gameObjectRegister.size(); i++)
	{
		gameObjectRegister[i]->Init_ShaderObjects(shaderLocations);
	}
}
开发者ID:TReed1104,项目名称:AdvancedGraphics,代码行数:24,代码来源:Pong.cpp


示例15: AfxEnableControlContainer

BOOL Crecord_playerApp::InitInstance() {

    AfxEnableControlContainer();

#ifdef _AFXDLL
    Enable3dControls();         // Call this when using MFC in a shared DLL
#else
    Enable3dControlsStatic();   // Call this when linking to MFC statically
#endif

    g_main_dlg = new Crecord_playerDlg;
  m_pMainWnd = g_main_dlg;

  g_main_dlg->Create(IDD_record_player_DIALOG,NULL);
    
    // create a new world
  world = new cWorld();

  // set background color
  world->setBackgroundColor(0.0f,0.0f,0.0f);

  // Create a camera
  camera = new cCamera(world);
  world->addChild(camera);

  // Create a light source and attach it to camera
  light = new cLight(world);
  light->setEnabled(true);
  light->setPos(cVector3d(2,1,1));

  // define camera position
  flagCameraInMotion = false;

  camera->set(cVector3d(2,0,1), cVector3d(0,0,0), cVector3d(0,0,1));

  // create a display for graphic rendering
  viewport = new cViewport(g_main_dlg->m_gl_area_hwnd, camera, true);
  viewport->setStereoOn(false);

  // init var
  m_rotPos = 0;
  m_rotVel = 0;
  m_inertia = 0.04;
  m_clock.initialize();
  m_lastGoodPosition = 0.0;

  m_reduction = 5.4*10;
  m_cpt = 120*4;          
  m_desiredPos = 0.0;
  m_P = 0.4;
  m_I = 0.0014;
  m_integratorVal = 0.0;
  m_D = 0.02;

  m_lastAngle = 0.0;

  m_velocity = 0;
  m_velocityOld = 0;

  m_RFDInitialAngle = 0.0;
  m_inContact = false;

  LoadModel(TURNTABLE_MODEL);

  object->translate(0,0,-0.3);

  // set stiffness
  double stiffness = (double)35;
  object->setStiffness(stiffness, true);

  // Initialize sound device and create audio stream
  if (!BASS_Init(1,44100,0,0,NULL))
      _cprintf("Init error %d\n", BASS_ErrorGetCode());
    
  // Load a record onto the record player
  load_record(0);
  
  object->computeGlobalPositions(false);
  world->computeGlobalPositions(false);

  return TRUE;
}
开发者ID:DanGrise,项目名称:HugMe,代码行数:82,代码来源:record_player.cpp


示例16: sPath

bool GLFramework::LoadModel(const char * path)
{
	bool success = true;
	//find extension
	std::string sPath(path);
	std::string ext = sPath.substr(sPath.find_last_of('.'));

	Geometry geometry;

	if (ext == ".obj")
	{
		std::vector<tinyobj::shape_t> shapes;
		std::vector<tinyobj::material_t> materials;
		std::string err = tinyobj::LoadObj(shapes, materials, path);
		if (err.length() != 0)
		{
			std::cout << "Error loading OBJ file:\n" << err << std::endl;
			success = false;
		}

		//hard coding only using first shape, can change to loop here
		if (success)
		{
			auto shape = shapes[0];
			auto mesh = shape.mesh;

			geometry.vertices.resize(mesh.positions.size());

			uint posIndex = 0;
			uint normalIndex = 0;
			uint UVIndex = 0;
			bool hasNormals = mesh.normals.size() == mesh.positions.size();
			bool hasUVs = mesh.texcoords.size() == mesh.positions.size();
			//obj has vectors of floats, my struct and shaders uses glm vecs so need to build myself
			for (uint vertexCount = 0; posIndex < mesh.positions.size(); vertexCount++)
			{
				float x = mesh.positions[posIndex++];
				float y = mesh.positions[posIndex++];
				float z = mesh.positions[posIndex++];
				geometry.vertices[vertexCount].position = vec4(x, y, z, 1);

				if (hasNormals)
				{
					x = mesh.normals[normalIndex++];
					y = mesh.normals[normalIndex++];
					z = mesh.normals[normalIndex++];
					geometry.vertices[vertexCount].normal = vec4(x, y, z, 1);
				}

				if (hasUVs)
				{
					x = mesh.texcoords[UVIndex++];
					y = mesh.texcoords[UVIndex++];
					geometry.vertices[vertexCount].UV = vec2(x, y);
				}
			}

			geometry.indices = mesh.indices;
		}
	}
	else if (ext == ".fbx")
	{


		FBXFile file;
		success = file.load(path, FBXFile::UNITS_METER, false, false, false);
		if (!success)
		{
			std::cout << "Error loading FBX file:\n";
		}
		else
		{
			//hardcoding to use single mesh, can loop here if needed.
			FBXMeshNode* mesh = file.getMeshByIndex(0);
			geometry.vertices.resize(mesh->m_vertices.size());

			for (int i = 0; i < mesh->m_vertices.size(); i++)
			{
				auto xVert = mesh->m_vertices[i];
				geometry.vertices[i].position = xVert.position;
				geometry.vertices[i].color = xVert.colour;
				geometry.vertices[i].normal = xVert.normal;
				geometry.vertices[i].UV = xVert.texCoord1;
			}

			geometry.indices = mesh->m_indices;

			file.unload();
		}

	}
	else
	{
		std::cout << "Unsupported format. Only support .obj or .fbx files.\n";
		success = false;
	}
	if (!success)
	{
		return false;
	}
//.........这里部分代码省略.........
开发者ID:JeffreyMJohnson,项目名称:YAGLF,代码行数:101,代码来源:GLFramework.cpp


示例17: LoadModel

/*
====================
idRenderModelMD5::InitFromFile
====================
*/
void idRenderModelMD5::InitFromFile( const char* fileName )
{
	name = fileName;
	LoadModel();
}
开发者ID:BielBdeLuna,项目名称:StormEngine2,代码行数:10,代码来源:Model_md5.cpp


示例18: main


//.........这里部分代码省略.........
  tiffFilterWarnings();
  iiRegisterQuitCheck(imodQuitCheck);

  /* Try to open the last file if there is one */
  if (firstfile) {
    qname = QDir::toNativeSeparators(QString(argv[argcHere - 1]));

    // first check if it is directory, if so say it is last image
    QFileInfo info(qname);
    if (info.isDir()) {
      lastimage = argcHere - 1;
    } else {
      mfin = fopen(LATIN1(qname), "rb");
      if (mfin == NULL) {

        /* Fail to open, and it is the only filename, then exit */
        if (firstfile == argcHere - 1) {
          imodError(NULL, "Couldn't open input file %s.\n", argv[argcHere - 1]);
          exit(10);
        }
        
        /* But if there are other files, set up to open new model with that name*/
        imodPrintStderr("Model file (%s) not found: opening "
                        "new model by that name.\n", argv[argcHere - 1]);
        
        lastimage = argcHere - 2;
        newModelCreated = true;
        
      } else {
        
        /*
         * Try loading file as a model.  Turn it on if successful
         */
        Model = LoadModel(mfin);
        if (Model) {
          if (Imod_debug)
            imodPrintStderr("Loaded model %s\n", argv[argcHere -1]);
          lastimage = argcHere - 2;
          Model->drawmode = 1;
          
          // Set this now in case image load is interrupted
          Model->csum = imodChecksum(Model);
        } else {
          /* If fail, last file is an image */
          lastimage = argcHere - 1;
        }
        fclose(mfin);
      }
    }
  }
  
  if (dataFromStdin) {

    // Data from stdin: check for contradictory options
    if (li.xmin != -1 || li.xmax != -1 || li.ymin != -1 || li.ymax != -1 ||
        li.zmin != -1 || li.zmax != -1) {
      imodError(NULL, "You cannot set subareas when reading data from stdin\n");
      exit(3);
    }
    if (plistfname || useStdin || rawSet || vi.vmSize || vi.imagePyramid) {
      imodError(NULL, "You cannot use -C, -L, -p, -py, or raw options when "
                "reading data from stdin\n");
      exit(3);
    }
    if (firstfile && lastimage >= firstfile) {
      imodError(NULL, "You cannot enter any image files when reading data from stdin\n");
开发者ID:imod-mirror,项目名称:IMOD,代码行数:67,代码来源:imod.cpp


示例19: LoadModel

void scene::Init() {
    LoadModel();
    LoadView();
    LoadLight();
}
开发者ID:AMBITIONBIN,项目名称:CG,代码行数:5,代码来源:scene.cpp


示例20: Init

/*
================
idClipModel::idClipModel
================
*/
idClipModel::idClipModel( const int renderModelHandle ) {
	Init();
	contents = CONTENTS_RENDERMODEL;
	LoadModel( renderModelHandle );
}
开发者ID:AndreiBarsan,项目名称:doom3.gpl,代码行数:10,代码来源:Clip.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LoadModule函数代码示例发布时间:2022-05-30
下一篇:
C++ LoadMenu函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap