本文整理汇总了C++中ModelPtr类的典型用法代码示例。如果您正苦于以下问题:C++ ModelPtr类的具体用法?C++ ModelPtr怎么用?C++ ModelPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModelPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetModel
ModelPtr GetModel(const std::string& modelName)
{
std::string name = boost::to_lower_copy(modelName) + ".mod";
auto fileIter = m_modelsByFile.find(name);
if (fileIter != m_modelsByFile.end())
{
return fileIter->second;
}
auto iter = m_models.find(modelName);
if (iter != m_models.end())
{
return iter->second;
}
EQEmu::EQGModelLoader model_loader;
ModelPtr model;
if (model_loader.Load(m_archive, name, model))
{
model->SetName(modelName);
m_models[modelName] = model;
}
return model;
}
示例2: surf_presolve
void surf_presolve(void)
{
double next_event_date = -1.0;
tmgr_trace_event_t event = NULL;
double value = -1.0;
ResourcePtr resource = NULL;
ModelPtr model = NULL;
unsigned int iter;
XBT_DEBUG
("First Run! Let's \"purge\" events and put models in the right state");
while ((next_event_date = tmgr_history_next_date(history)) != -1.0) {
if (next_event_date > NOW)
break;
while ((event =
tmgr_history_get_next_event_leq(history, next_event_date,
&value,
(void **) &resource))) {
if (value >= 0){
resource->updateState(event, value, NOW);
}
}
}
xbt_dynar_foreach(model_list, iter, model)
model->updateActionsState(NOW, 0.0);
}
示例3: TwoPassZbuffer
void Optimizer::TwoPassZbuffer(const CameraParameter& rho, const IlluminationParameter& lamda, MeshPtr mesh, ModelPtr model, bool segment)
{
int width = model->Rows();
int height = model->Cols();
mesh->UpdateVertexNormal();
shared_ptr<Camera> camera = make_shared<PinholeCamera>(rho, width, height);
shared_ptr<Camera> light = make_shared<PinholeCamera>(rho, lamda, width, height);
shared_ptr<Illumination> illumination = make_shared<PhongIllumination>(lamda);
HardwareRender render(camera, illumination);
vector<float> depth_map(width*height);
render.Rendering(mesh, lamda, depth_map);
HardwareRender render2(light, illumination);
vector<float> shadow_map(width*height);
render2.Rendering(mesh, lamda, shadow_map);
shared_ptr<DepthBuffer> object_depth = nullptr;
shared_ptr<BoxRaster> raster = nullptr;
SoftwareRender object_render(camera, illumination, object_depth, raster);
if (segment)
{
object_render.TwoPassZbufferSegment(light, mesh, model, depth_map, shadow_map);
}
else
{
object_render.TwoPassZbuffer(light, mesh, model, depth_map, shadow_map);
}
}
示例4: reprModel
void EditorChunkFlare::draw()
{
if (!edShouldDraw())
return;
ModelPtr model = reprModel();
if( WorldManager::instance().drawSelection() && model)
{
// draw a some points near the centre of the reprModel, so the system
// can be selected from the distance where the repr model might be
// smaller than a pixel and fail to draw.
Moo::rc().push();
Moo::rc().world( chunk()->transform() );
Moo::rc().preMultiply( edTransform() );
// bias of half the size of the representation model's bounding box in
// the vertical axis, because the object might be snapped to terrain
// or another object, so the centre might be below something else.
float bias = model->boundingBox().width() / 2.0f;
Vector3 points[3];
points[0] = Vector3( 0.0f, -bias, 0.0f );
points[1] = Vector3( 0.0f, 0.0f, 0.0f );
points[2] = Vector3( 0.0f, bias, 0.0f );
Geometrics::drawPoints( points, 3, 3.0f, (DWORD)this );
Moo::rc().pop();
}
EditorChunkSubstance<ChunkFlare>::draw();
}
示例5: setGazeboModel
void ThrusterTask::setGazeboModel( ModelPtr model )
{
string taskName = "gazebo:" + model->GetWorld()->GetName() + ":" + model->GetName() + ":gazebo_thruster";
provides()->setName(taskName);
_name.set(taskName);
topicName = model->GetName() + "/thrusters";
}
开发者ID:Brazilian-Institute-of-Robotics,项目名称:simulation-orogen-rock_gazebo,代码行数:8,代码来源:ThrusterTask.cpp
示例6: ShowPoints
void Optimizer::ShowPoints(mat& alpha,
mat& beta,
mat& rho,
mat& lamda,
InputPtr input,
ModelPtr model,
MeshPtr mesh,
ShapePtr shape,
TexturePtr texture,
int point_type)
{
mat alpha_gradient(PrincipalNum, 1);
alpha_gradient.fill(0);
mat beta_gradient(PrincipalNum, 1);
beta_gradient.fill(0);
mat rho_gradient(RhoNum, 1);
rho_gradient.fill(0);
mat lamda_gradient(LamdaNum, 1);
lamda_gradient.fill(0);
Alpha alpha_para(alpha, input, model, mesh, shape, texture);
Beta beta_para(beta, model, mesh, shape, texture);
Rho rho_para(rho, input, model, mesh, shape, texture);
Lamda lamda_para(lamda, model, mesh, shape, texture);
switch (point_type)
{
case RANDOM:
model->InitialRandomGenerator();
GenerateRandomPoints(model, 40);
ShowRandomPoints(input, model, &alpha_para);
break;
case VISIBLE_TRIANGLE:
model->EnableIterator();
ShowVisiblePoints(input, model, &alpha_para);
break;
case SHADOW_TRIANGLE:
model->EnableIterator();
ShowShadowPoints(input, model, &alpha_para);
break;
case SEGMENT:
ShowSegmentPoints(input, model, &alpha_para);
break;
default:
break;
}
model->Show();
}
示例7: add
void add(ModelPtr model)
{
auto it = models.at(model->get_id());
if (it == models.end())
{
models.emplace(model->get_id(), model);
added.trigger(*model);
}
}
示例8: Load
virtual bool Load() override
{
bool loadedSomething = m_archive.Open(GetZoneFile(m_zd));
std::string base_filename = (boost::format("%s\\%s")
% m_zd->GetEQPath()
% m_zd->GetZoneName()).str();
// next we need to try to read an _assets file and load more eqg based data.
std::string assets_file = base_filename + "_assets.txt";
std::error_code ec;
if (sys::exists(assets_file, ec))
{
std::vector<std::string> filenames;
std::ifstream assets(assets_file.c_str());
if (assets.is_open())
{
std::copy(std::istream_iterator<std::string>(assets),
std::istream_iterator<std::string>(),
std::back_inserter(filenames));
for (auto& name : filenames)
{
std::string asset_file = (boost::format("%s\\%s") % m_zd->GetEQPath() % name).str();
EQEmu::PFS::Archive archive;
if (!archive.Open(asset_file))
continue;
std::vector<std::string> models;
if (archive.GetFilenames("mod", models))
{
for (auto& modelName : models)
{
EQEmu::EQGModelLoader model_loader;
ModelPtr model;
model_loader.Load(archive, modelName, model);
if (model)
{
model->SetName(modelName);
m_modelsByFile[modelName] = model;
loadedSomething = true;
}
}
}
}
}
}
return loadedSomething;
}
示例9: ShowVisiblePoints
void Optimizer::ShowVisiblePoints(InputPtr input, ModelPtr model, Parameter* para) const
{
int num = model->Size();
for (int i = 0; i<num;++i)
{
ivec2 pos = para->ComputePosition(i);
vec3 rgb = para->ComputeColor(i);
//vec3 rgb = input_image->GetColor(Point(pos[0], pos[1]));
//Vec3b color(static_cast<uchar>(rgb[2]), static_cast<uchar>(rgb[1]), static_cast<uchar>(rgb[0]));
Vec3b color(0, 0, 255);
model->WriteColor(pos[0], pos[1], color);
}
cout << "visible triangle number = " << num << endl;
}
示例10: CpuRendering
void Optimizer::CpuRendering(const CameraParameter& rho,
const IlluminationParameter& lamda,
MeshPtr mesh,
ModelPtr model)
{
int width = model->Rows();
int height = model->Cols();
shared_ptr<Camera> camera = make_shared<PinholeCamera>(rho, width, height);
shared_ptr<Illumination> illumination = make_shared<PhongIllumination>(lamda);
shared_ptr<DepthBuffer> depth = make_shared<DepthBuffer>(width, height);
shared_ptr<BoxRaster> raster = make_shared<BoxRaster>();
SoftwareRender cpu_render(camera, illumination, depth, raster);
cpu_render.Rending(mesh, model);
}
示例11: FitRest
void Optimizer::FitRest(mat& alpha,
mat& beta,
mat& rho,
mat& lamda,
InputPtr input,
ModelPtr model,
MeshPtr mesh,
ShapePtr shape,
TexturePtr texture)
{
mat alpha_gradient = mat(PrincipalNum, 1, fill::zeros);
mat alpha_hessian_inv = mat(PrincipalNum, PrincipalNum, fill::zeros);
mat beta_gradient = mat(PrincipalNum, 1, fill::zeros);
mat beta_hessian_inv = mat(PrincipalNum, PrincipalNum, fill::zeros);
Rho rho_para(rho, input, model, mesh, shape, texture);
Lamda lamda_para(lamda, model, mesh, shape, texture);
// 2500 1000 700 500 300 200
model->InitialRandomGenerator(ModelImage::REST);
double weight = 1.0 / 200;
for (int l = 0; l < 1000; ++l)
{
Alpha alpha_para(alpha, input, model, mesh, shape, texture);
Beta beta_para(beta, model, mesh, shape, texture);
// Generate random points
GenerateRandomPoints(model, GradientRandomNum);
double function_value = 0;
for (int i = 0; i < PrincipalNum; ++i)
{
double variance = shape->GetVariance(i);
alpha_gradient[i] = weight * ComputeIntensityGradient(input, &alpha_para, i) + 2 * alpha[i] / variance;
}
for (int i = 0; i < PrincipalNum; ++i)
{
double variance = texture->GetVariance(i);
beta_gradient[i] = weight * ComputeIntensityGradient(input, &beta_para, i) + 2 * beta[i] / variance;
}
alpha -= alpha_para.Step*alpha_gradient;
beta -= beta_para.Step*beta_gradient;
}
}
示例12: hasher
ModelHandler ResourceManager::GetAnimatedModelFromFile(std::string fileName,std::string resID)
{
unsigned int id = hasher(resID);
if(pool->ModelExist(id))
{
return ModelHandler(pool->GetModel(id),id,pool);
}
else
{
ModelPtr modelPtr = AssetLoader::GetPtr()->LoadAnimatedModel(fileName);
if(modelPtr.IsNull())
return ModelHandler(false);
pool->AddModel(id,modelPtr);
return ModelHandler(modelPtr,id,pool);
}
}
示例13: GpuRendering
void Optimizer::GpuRendering(const CameraParameter& rho,
const IlluminationParameter& lamda,
MeshPtr mesh,
ModelPtr model)
{
int width = model->Rows();
int height = model->Cols();
mesh->UpdateVertexNormal();
shared_ptr<Camera> camera = make_shared<PinholeCamera>(rho, width, height);
shared_ptr<Camera> light = make_shared<PinholeCamera>(rho, lamda, ShadowResolution, ShadowResolution);
shared_ptr<Illumination> illumination = make_shared<PhongIllumination>(lamda);
//HardwareRender gpu_render(camera, light,illumination);
HardwareRender gpu_render(camera, illumination);
gpu_render.RenderingWithBackground(mesh, model, lamda);
//gpu_render.RenderingWithShadow(mesh, lamda);
}
示例14: remove
void remove(ModelPtr model)
{
auto it = models.at(model->get_id());
if (it != models.end())
{
models.erase(it);
removed.trigger(*model);
}
}
示例15: ShowShadowPoints
void Optimizer::ShowShadowPoints(InputPtr input, ModelPtr model, Parameter* para) const
{
int num = model->Size();
int shadow_counter = 0;
for (int i = 0; i< num; ++i)
{
if (model->visible_triangles_[i].cast_shadow)
{
++shadow_counter;
ivec2 pos = para->ComputePosition(i);
vec3 rgb = para->ComputeColor(i);
//vec3 rgb = input_image->GetColor(Point(pos[0], pos[1]));
// Vec3b color(static_cast<uchar>(rgb[2]), static_cast<uchar>(rgb[1]), static_cast<uchar>(rgb[0]));
Vec3b color(0, 0, 255);
model->WriteColor(pos[0], pos[1], color);
}
}
cout << "shadow triangle number = " << shadow_counter << endl;
}