mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
What the... Not sure what was going on here with the reverse passing...
This commit is contained in:
parent
18b77cd003
commit
df30588d74
@ -4,15 +4,16 @@
|
||||
|
||||
#include "glm\gtc\matrix_transform.hpp"
|
||||
|
||||
ace::simulation::vertex::vertex(vertex_table & _table, ace::vector3<float> _vertex, uint32_t _id) : table(_table), vertex_id(_id)
|
||||
ace::simulation::vertex::vertex(vertex_table & _table, ace::vector3<float> _vertex, uint32_t _id, bool reversed) : table(_table), vertex_id(_id)
|
||||
{
|
||||
this->original_vertex = _vertex;
|
||||
this->animated_vertex = _vertex;
|
||||
//this->original_vertex.z(this->original_vertex.z()*-1);
|
||||
//this->animated_vertex.z(this->animated_vertex.z()*-1);
|
||||
//this->original_vertex.x(this->original_vertex.x()*-1);
|
||||
//this->animated_vertex.x(this->animated_vertex.x()*-1);
|
||||
|
||||
if(reversed) {
|
||||
this->original_vertex.z(this->original_vertex.z()*-1);
|
||||
this->animated_vertex.z(this->animated_vertex.z()*-1);
|
||||
this->original_vertex.x(this->original_vertex.x()*-1);
|
||||
this->animated_vertex.x(this->animated_vertex.x()*-1);
|
||||
}
|
||||
}
|
||||
|
||||
ace::simulation::vertex::~vertex()
|
||||
@ -75,7 +76,7 @@ void ace::simulation::named_selection::animate(const glm::mat4 &matrix)
|
||||
|
||||
|
||||
|
||||
ace::simulation::vertex_table::vertex_table(const ace::p3d::vertex_table_p p3d_vertex_table, const ace::p3d::lod_p p3d_lod, const ace::p3d::model_p p3d) : animated(false)
|
||||
ace::simulation::vertex_table::vertex_table(const ace::p3d::vertex_table_p p3d_vertex_table, const ace::p3d::lod_p p3d_lod, const ace::p3d::model_p p3d, bool reversed) : animated(false)
|
||||
{
|
||||
this->vertices.resize(p3d_vertex_table->points.size);
|
||||
ace::vector3<float> center_off2 = p3d_lod->min_pos+p3d_lod->max_pos-p3d_lod->autocenter_pos;
|
||||
@ -83,10 +84,10 @@ ace::simulation::vertex_table::vertex_table(const ace::p3d::vertex_table_p p3d_v
|
||||
for (uint32_t i = 0; i <= p3d_vertex_table->points.size - 1; ++i) {
|
||||
if (p3d->info->autocenter) {
|
||||
ace::vector3<float> new_vertex = p3d_vertex_table->points[i] + center_off;
|
||||
this->vertices[i] = std::make_shared<vertex>(*this, new_vertex, i);
|
||||
this->vertices[i] = std::make_shared<vertex>(*this, new_vertex, i, reversed);
|
||||
}
|
||||
else {
|
||||
this->vertices[i] = std::make_shared<vertex>(*this, p3d_vertex_table->points[i], i);
|
||||
this->vertices[i] = std::make_shared<vertex>(*this, p3d_vertex_table->points[i], i, reversed);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -95,10 +96,10 @@ ace::simulation::vertex_table::~vertex_table()
|
||||
{
|
||||
}
|
||||
|
||||
ace::simulation::lod::lod(const ace::p3d::lod_p p3d_lod, const ace::p3d::model_p p3d)
|
||||
ace::simulation::lod::lod(const ace::p3d::lod_p p3d_lod, const ace::p3d::model_p p3d, bool reversed)
|
||||
{
|
||||
this->id = p3d_lod->id;
|
||||
this->vertices = vertex_table(p3d_lod->vertices, p3d_lod, p3d);
|
||||
this->vertices = vertex_table(p3d_lod->vertices, p3d_lod, p3d, reversed);
|
||||
this->autocenter_pos = p3d->info->cog_offset;//p3d->info->center_of_gravity + p3d->info->offset_2 + p3d->info->cog_offset;
|
||||
|
||||
for (ace::p3d::face_p p3d_face : p3d_lod->faces) {
|
||||
@ -390,7 +391,7 @@ ace::simulation::object::object()
|
||||
ace::simulation::object::object(const ace::p3d::model_p model, bool reverse_ = false) : reversed(reverse_)
|
||||
{
|
||||
for (ace::p3d::lod_p p3d_lod : model->lods) {
|
||||
lod_p new_lod = std::make_shared<lod>(p3d_lod, model);
|
||||
lod_p new_lod = std::make_shared<lod>(p3d_lod, model, reversed);
|
||||
this->lods.push_back(new_lod);
|
||||
this->lods[p3d_lod->id]->type = model->info->resolutions[p3d_lod->id];
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ namespace ace {
|
||||
class vertex_table {
|
||||
public:
|
||||
vertex_table() {};
|
||||
vertex_table(const ace::p3d::vertex_table_p, const ace::p3d::lod_p, const ace::p3d::model_p);
|
||||
vertex_table(const ace::p3d::vertex_table_p, const ace::p3d::lod_p, const ace::p3d::model_p, bool);
|
||||
~vertex_table();
|
||||
vertex_p operator[] (const int index) { return vertices[index]; }
|
||||
std::vector<vertex_p> vertices;
|
||||
@ -65,7 +65,7 @@ namespace ace {
|
||||
|
||||
class vertex {
|
||||
public:
|
||||
vertex(vertex_table &, ace::vector3<float>, uint32_t);
|
||||
vertex(vertex_table &, ace::vector3<float>, uint32_t, bool);
|
||||
~vertex();
|
||||
|
||||
ace::vector3<float> operator * (const float &v) { return animated_vertex * v; }
|
||||
@ -108,7 +108,7 @@ namespace ace {
|
||||
class lod {
|
||||
public:
|
||||
lod() {};
|
||||
lod(const ace::p3d::lod_p, const ace::p3d::model_p);
|
||||
lod(const ace::p3d::lod_p, const ace::p3d::model_p, bool);
|
||||
~lod();
|
||||
uint32_t id;
|
||||
uint32_t type;
|
||||
@ -202,7 +202,7 @@ namespace ace {
|
||||
class object {
|
||||
public:
|
||||
object();
|
||||
object(const ace::p3d::model_p, bool reversed);
|
||||
object(const ace::p3d::model_p, bool);
|
||||
~object();
|
||||
|
||||
bool reversed;
|
||||
|
@ -2,5 +2,5 @@
|
||||
init:
|
||||
debug_render:
|
||||
register_vehicle:\x\nou\addons\anim_test\anim_test.p3d,0,4050.18;3802.55;5.075
|
||||
set_animation_state:0, turret, 0.0, rotation_drum, 0.0, barrel_recoil, -6, barrel_hide, 0
|
||||
set_animation_state:0, turret, 1.0, rotation_drum, 0.5, barrel_recoil, -4, barrel_hide, 0
|
||||
#set_animation_state:0, turret, 0.500
|
@ -20,7 +20,7 @@ namespace ace {
|
||||
|
||||
class base_vehicle {
|
||||
public:
|
||||
base_vehicle(uint32_t, ace::simulation::object_p, ace::vector3<float>);
|
||||
base_vehicle(uint32_t, ace::simulation::object_p, bool, ace::vector3<float>);
|
||||
~base_vehicle();
|
||||
|
||||
bool simulate();
|
||||
|
@ -111,7 +111,7 @@ namespace ace {
|
||||
|
||||
if (ace::model_collection::get().load_model(model_str)) {
|
||||
std::shared_ptr<ace::simulation::object> _object = std::make_shared<ace::simulation::object>(model_collection::get().models[model_str].model, (static_cast<int>(_args[2]) != 0 ? true : false));
|
||||
vehicle_p _vehicle = std::make_shared<vehicle>(static_cast<uint32_t>(_args[1]), _object, _args[2]);
|
||||
vehicle_p _vehicle = std::make_shared<vehicle>(static_cast<uint32_t>(_args[1]), _object, false, _args[2]);
|
||||
vehicles[static_cast<uint32_t>(_args[1])] = _vehicle;
|
||||
|
||||
// For results on a valid vehicle registration, we return its animation names for that given vehicle
|
||||
@ -263,9 +263,9 @@ namespace ace {
|
||||
#endif
|
||||
#ifdef _DEBUG
|
||||
bool controller::_test_raycast(const arguments &_args, std::string & result) {
|
||||
ace::simulation::object * _object = new ace::simulation::object(model_collection::get().models[0].model);
|
||||
ace::simulation::object * _object = new ace::simulation::object(model_collection::get().models[0].model, false);
|
||||
std::shared_ptr<ace::simulation::object> _object_ptr(_object);
|
||||
ace::vehicledamage::vehicle _vehicle(12345, _object_ptr, ace::vector3<float>(0,0,0));
|
||||
ace::vehicledamage::vehicle _vehicle(12345, _object_ptr, false, ace::vector3<float>(0,0,0));
|
||||
|
||||
btVector3 from(1000.0f, 1000.0f, 1000.0f), to(-1000.0f, -1000.0f, -1000.0f);
|
||||
|
||||
@ -294,9 +294,9 @@ namespace ace {
|
||||
return true;
|
||||
}
|
||||
bool controller::_test_selection(const arguments &_args, std::string & result) {
|
||||
ace::simulation::object * _object = new ace::simulation::object(model_collection::get().models[0].model);
|
||||
ace::simulation::object * _object = new ace::simulation::object(model_collection::get().models[0].model, false);
|
||||
std::shared_ptr<ace::simulation::object> _object_ptr(_object);
|
||||
ace::vehicledamage::vehicle _vehicle(12345, _object_ptr, ace::vector3<float>(0, 0, 0));
|
||||
ace::vehicledamage::vehicle _vehicle(12345, _object_ptr, false, ace::vector3<float>(0, 0, 0));
|
||||
|
||||
std::vector<ace::vector3<float>> _vertices = _vehicle.selection_by_name_vertices(-1, _args[0]);
|
||||
|
||||
|
@ -9,7 +9,7 @@ namespace ace {
|
||||
namespace vehicledamage {
|
||||
class vehicle : public base_vehicle {
|
||||
public:
|
||||
vehicle(uint32_t id, ace::simulation::object_p object_, ace::vector3<float> position_) : base_vehicle(id, object_, position_) {}
|
||||
vehicle(uint32_t id, ace::simulation::object_p object_, bool reversed_, ace::vector3<float> position_) : base_vehicle(id, object_, reversed_, position_) {}
|
||||
|
||||
bool hit(gamehit *);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user