Skip to content

Commit

Permalink
Add VisualActor
Browse files Browse the repository at this point in the history
  • Loading branch information
sarthou committed Jan 13, 2025
1 parent 3ed87b6 commit 9f65b88
Show file tree
Hide file tree
Showing 19 changed files with 4,265,340 additions and 3 deletions.
50 changes: 50 additions & 0 deletions include/overworld/Engine/Common/Urdf/VisualActor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#ifndef OWDS_COMMON_VISUALACTOR_H
#define OWDS_COMMON_VISUALACTOR_H

#include <array>
#include <set>
#include <vector>

#include "overworld/Engine/Common/Shapes/Shape.h"
#include "overworld/Engine/Common/Urdf/Actor.h"

namespace owds {

class VisualActor : public Actor
{
public:
explicit VisualActor(const std::vector<owds::Shape>& visual_shapes);

~VisualActor() noexcept override {};
void setup(const std::array<double, 3>& position,
const std::array<double, 4>& orientation) override;

void remove() override {}

void setPhysicsEnabled(bool enabled) override;
void setSimulationEnabled(bool enabled) override;
void setMass(float mass_kg) override;
void setStaticFriction(float coefficient) override;
void setDynamicFriction(float coefficient) override;
void setRestitution(float coefficient) override;

/**
* @param position Absolute position.
* @param orientation Absolute rotation, in radians.
*/
void setPositionAndOrientation(const std::array<double, 3>& position, const std::array<double, 4>& orientation) override;
void setVelocity(const std::array<double, 3>& linear_velocity, const std::array<double, 3>& angular_velocity) override;

AABB_t getAABB() override;
AABB_t getLocalAABB() override;

std::array<float, 16> getModelMatrix() const override;
std::pair<std::array<double, 3>, std::array<double, 4>> getPositionAndOrientation() const override;

private:
std::array<double, 3> position_;
std::array<double, 4> orientation_;
};
} // namespace owds

#endif // OWDS_COMMON_VISUALACTOR_H
4 changes: 4 additions & 0 deletions include/overworld/Engine/Common/World.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ namespace owds {
const glm::vec3& position = {0., 0., 0.},
const glm::vec3& rotation = {0., 0., 0.});

size_t createVisualActor(const std::vector<owds::urdf::Geometry_t>& visual_geometries,
const glm::vec3& position = {0., 0., 0.},
const glm::vec3& rotation = {0., 0., 0.});

size_t loadUrdf(const std::string& path,
const std::array<float, 3>& position,
const std::array<float, 3>& orientation,
Expand Down
Binary file added models/trees/BarkDecidious0143_5_S.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added models/trees/BarkDecidious0194_7_S.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added models/trees/Leaves0120_35_S.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added models/trees/Leaves0142_4_S.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added models/trees/Leaves0156_1_S.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions models/trees/Tree1.mtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Blender MTL File: 'Tree1.blend'
# Material Count: 2

newmtl Leaves
Ns 225.000000
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

newmtl Material.001
Ns 225.000000
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
Loading

0 comments on commit 9f65b88

Please sign in to comment.