Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add meterial element index #4467

Merged
merged 5 commits into from
May 2, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AirLib/include/api/RpcLibClientBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ namespace airlib
void simSetKinematics(const Kinematics::State& state, bool ignore_collision, const std::string& vehicle_name = "");
msr::airlib::Environment::State simGetGroundTruthEnvironment(const std::string& vehicle_name = "") const;
std::vector<std::string> simSwapTextures(const std::string& tags, int tex_id = 0, int component_id = 0, int material_id = 0);
bool simSetObjectMaterial(const std::string& object_name, const std::string& material_name);
bool simSetObjectMaterialFromTexture(const std::string& object_name, const std::string& texture_path);
bool simSetObjectMaterial(const std::string& object_name, const std::string& material_name, const int component_id = 0);
bool simSetObjectMaterialFromTexture(const std::string& object_name, const std::string& texture_path, const int component_id = 0);

// Recording APIs
void startRecording();
Expand Down
4 changes: 2 additions & 2 deletions AirLib/include/api/WorldSimApiBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ namespace airlib
virtual bool setObjectScale(const std::string& object_name, const Vector3r& scale) = 0;
virtual std::unique_ptr<std::vector<std::string>> swapTextures(const std::string& tag, int tex_id = 0, int component_id = 0, int material_id = 0) = 0;
virtual bool setLightIntensity(const std::string& light_name, float intensity) = 0;
virtual bool setObjectMaterial(const std::string& object_name, const std::string& material_name) = 0;
virtual bool setObjectMaterialFromTexture(const std::string& object_name, const std::string& texture_path) = 0;
virtual bool setObjectMaterial(const std::string& object_name, const std::string& material_name, const int component_id = 0) = 0;
virtual bool setObjectMaterialFromTexture(const std::string& object_name, const std::string& texture_path, const int component_id = 0) = 0;
virtual vector<MeshPositionVertexBuffersResponse> getMeshPositionVertexBuffers() const = 0;

virtual bool createVoxelGrid(const Vector3r& position, const int& x_size, const int& y_size, const int& z_size, const float& res, const std::string& output_file) = 0;
Expand Down
8 changes: 4 additions & 4 deletions AirLib/src/api/RpcLibClientBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,14 +493,14 @@ __pragma(warning(disable : 4239))
return pimpl_->client.call("simSwapTextures", tags, tex_id, component_id, material_id).as<vector<string>>();
}

bool RpcLibClientBase::simSetObjectMaterial(const std::string& object_name, const std::string& material_name)
bool RpcLibClientBase::simSetObjectMaterial(const std::string& object_name, const std::string& material_name, const int component_id)
{
return pimpl_->client.call("simSetObjectMaterial", object_name, material_name).as<bool>();
return pimpl_->client.call("simSetObjectMaterial", object_name, material_name, component_id).as<bool>();
}

bool RpcLibClientBase::simSetObjectMaterialFromTexture(const std::string& object_name, const std::string& texture_path)
bool RpcLibClientBase::simSetObjectMaterialFromTexture(const std::string& object_name, const std::string& texture_path, const int component_id)
{
return pimpl_->client.call("simSetObjectMaterialFromTexture", object_name, texture_path).as<bool>();
return pimpl_->client.call("simSetObjectMaterialFromTexture", object_name, texture_path, component_id).as<bool>();
}

bool RpcLibClientBase::simLoadLevel(const string& level_name)
Expand Down
8 changes: 4 additions & 4 deletions AirLib/src/api/RpcLibServerBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,12 +477,12 @@ namespace airlib
return *getWorldSimApi()->swapTextures(tag, tex_id, component_id, material_id);
});

pimpl_->server.bind("simSetObjectMaterial", [&](const std::string& object_name, const std::string& material_name) -> bool {
return getWorldSimApi()->setObjectMaterial(object_name, material_name);
pimpl_->server.bind("simSetObjectMaterial", [&](const std::string& object_name, const std::string& material_name, const int component_id) -> bool {
return getWorldSimApi()->setObjectMaterial(object_name, material_name, component_id);
});

pimpl_->server.bind("simSetObjectMaterialFromTexture", [&](const std::string& object_name, const std::string& texture_path) -> bool {
return getWorldSimApi()->setObjectMaterialFromTexture(object_name, texture_path);
pimpl_->server.bind("simSetObjectMaterialFromTexture", [&](const std::string& object_name, const std::string& texture_path, const int component_id) -> bool {
return getWorldSimApi()->setObjectMaterialFromTexture(object_name, texture_path, component_id);
});

pimpl_->server.bind("startRecording", [&]() -> void {
Expand Down
Loading