mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Yea. Chasing offsets. Turns out there is no need to offset anything.
This commit is contained in:
parent
a027fe0a3f
commit
433101c489
@ -19,6 +19,6 @@ for [{_i=0}, {_i<(count _this)-1}, {_i=_i+3}] do {
|
|||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
//TRACE_1("", _points);
|
//TRACE_1("", _points);
|
||||||
GVAR(debug_lines) pushBack [(ASLToATL (_points select 0)), (ASLToATL (_points select 1))];
|
GVAR(debug_lines) pushBack [((_points select 0)), ((_points select 1))];
|
||||||
GVAR(debug_lines) pushBack [(ASLToATL (_points select 1)), (ASLToATL (_points select 2))];
|
GVAR(debug_lines) pushBack [((_points select 1)), ((_points select 2))];
|
||||||
GVAR(debug_lines) pushBack [(ASLToATL (_points select 2)), (ASLToATL (_points select 0))];
|
GVAR(debug_lines) pushBack [((_points select 2)), ((_points select 0))];
|
@ -110,17 +110,17 @@ 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, bool reversed) : 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);
|
this->vertices.resize(p3d_vertex_table->points.size);
|
||||||
ace::vector3<float> center_off = p3d->info->cog_offset;//p3d->info->center_of_gravity + p3d->info->offset_2 + p3d->info->cog_offset;
|
ace::vector3<float> center_off = p3d_lod->autocenter_pos;//p3d->info->cog_offset;//p3d->info->center_of_gravity + p3d->info->offset_2 + p3d->info->cog_offset;
|
||||||
center_off.y(center_off.y() * 2);
|
//center_off.y(center_off.y() * 2);
|
||||||
center_off.x(0);
|
//center_off.x(0);
|
||||||
center_off.z(0);
|
//center_off.z(0);
|
||||||
if (reversed) {
|
if (reversed) {
|
||||||
center_off.x(center_off.x()*-1);
|
center_off.x(center_off.x()*-1);
|
||||||
center_off.z(center_off.z()*-1);
|
center_off.z(center_off.z()*-1);
|
||||||
}
|
}
|
||||||
for (uint32_t i = 0; i <= p3d_vertex_table->points.size - 1; ++i) {
|
for (uint32_t i = 0; i <= p3d_vertex_table->points.size - 1; ++i) {
|
||||||
if (p3d->info->autocenter) {
|
if (p3d->info->autocenter) {
|
||||||
ace::vector3<float> new_vertex = p3d_vertex_table->points[i] + center_off;
|
ace::vector3<float> new_vertex = p3d_vertex_table->points[i];
|
||||||
this->vertices[i] = std::make_shared<vertex>(*this, new_vertex, i, reversed);
|
this->vertices[i] = std::make_shared<vertex>(*this, new_vertex, i, reversed);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -137,10 +137,10 @@ ace::simulation::lod::lod(const ace::p3d::lod_p p3d_lod, const ace::p3d::model_p
|
|||||||
{
|
{
|
||||||
this->id = p3d_lod->id;
|
this->id = p3d_lod->id;
|
||||||
this->vertices = vertex_table(p3d_lod->vertices, p3d_lod, p3d, reversed);
|
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;
|
this->autocenter_pos = p3d_lod->autocenter_pos;//p3d->info->center_of_gravity + p3d->info->offset_2 + p3d->info->cog_offset;
|
||||||
autocenter_pos.y(autocenter_pos.y() * 2);
|
//autocenter_pos.y(autocenter_pos.y() * 2);
|
||||||
autocenter_pos.x(0);
|
//autocenter_pos.x(0);
|
||||||
autocenter_pos.z(0);
|
//autocenter_pos.z(0);
|
||||||
if (reversed) {
|
if (reversed) {
|
||||||
this->autocenter_pos.x(this->autocenter_pos.x()*-1);
|
this->autocenter_pos.x(this->autocenter_pos.x()*-1);
|
||||||
this->autocenter_pos.z(this->autocenter_pos.z()*-1);
|
this->autocenter_pos.z(this->autocenter_pos.z()*-1);
|
||||||
@ -178,15 +178,15 @@ ace::simulation::lod_animation_info::lod_animation_info(
|
|||||||
{
|
{
|
||||||
this->index = p3d_animate_bone->index;
|
this->index = p3d_animate_bone->index;
|
||||||
if (p3d->info->autocenter) {
|
if (p3d->info->autocenter) {
|
||||||
ace::vector3<float> center_off = p3d->info->cog_offset;//p3d->info->center_of_gravity + p3d->info->offset_2 + p3d->info->cog_offset;
|
ace::vector3<float> center_off = _lod->autocenter_pos;//p3d->info->cog_offset;//p3d->info->center_of_gravity + p3d->info->offset_2 + p3d->info->cog_offset;
|
||||||
center_off.y(center_off.y() * 2);
|
//center_off.y(center_off.y() * 2);
|
||||||
center_off.x(0);
|
//center_off.x(0);
|
||||||
center_off.z(0);
|
//center_off.z(0);
|
||||||
if (reversed) {
|
if (reversed) {
|
||||||
center_off.x(center_off.x()*-1);
|
center_off.x(center_off.x()*-1);
|
||||||
center_off.z(center_off.z()*-1);
|
center_off.z(center_off.z()*-1);
|
||||||
}
|
}
|
||||||
this->axis_position = p3d_animate_bone->axis_position + center_off;
|
this->axis_position = p3d_animate_bone->axis_position;
|
||||||
this->axis_direction = p3d_animate_bone->axis_direction;
|
this->axis_direction = p3d_animate_bone->axis_direction;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#c:\arma\arma3\addons\static_f_gamma.pbo C:\dev\ace3\extensions\tests\AT_01.txt
|
#c:\arma\arma3\addons\static_f_gamma.pbo C:\dev\ace3\extensions\tests\AT_01.txt
|
||||||
init:
|
init:
|
||||||
debug_render:
|
debug_render:
|
||||||
register_vehicle:\x\nou\addons\anim_test\anim_test.p3d,0,4050.18;3802.55;5.075
|
register_vehicle:\x\nou\addons\anim_test\anim_test.p3d,0,0,4050.18;3802.55;5.075
|
||||||
set_animation_state:0, turret, 1.0, rotation_drum, 0.5, barrel_recoil, -4, 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
|
#set_animation_state:0, turret, 0.500
|
@ -19,8 +19,24 @@ namespace ace {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fire_lod == -1) // @TODO: fallback on geo LOD
|
if (fire_lod == -1) {
|
||||||
fire_lod = 0;
|
for (int x = 0; x < object_->lods.size(); x++) {
|
||||||
|
if (object_->lods[x]->type == LOD_TYPE_GEOMETRY) {
|
||||||
|
fire_lod = x;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (fire_lod == -1) {
|
||||||
|
for (int x = 0; x < object_->lods.size(); x++) {
|
||||||
|
if (object_->lods[x]->type == LOD_TYPE_GEOMETRY_VIEW) {
|
||||||
|
fire_lod = x;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if (fire_lod == -1) // @TODO: fallback on geo LOD
|
||||||
|
// fire_lod = 0;
|
||||||
//fire_lod = 0;
|
//fire_lod = 0;
|
||||||
assert(fire_lod != -1);
|
assert(fire_lod != -1);
|
||||||
|
|
||||||
|
@ -125,9 +125,9 @@ namespace ace {
|
|||||||
if (model_str[0] == '\\') {
|
if (model_str[0] == '\\') {
|
||||||
model_str.erase(model_str.begin());
|
model_str.erase(model_str.begin());
|
||||||
}
|
}
|
||||||
|
std::string model_key = "";
|
||||||
if (ace::model_collection::get().load_model(model_str)) {
|
if (ace::model_collection::get().load_model(model_str, model_key)) {
|
||||||
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));
|
std::shared_ptr<ace::simulation::object> _object = std::make_shared<ace::simulation::object>(model_collection::get().models[model_key].model, (static_cast<int>(_args[2]) != 0 ? true : false));
|
||||||
vehicle_p _vehicle = std::make_shared<vehicle>(static_cast<uint32_t>(_args[1]), _object, false, _args[3]);
|
vehicle_p _vehicle = std::make_shared<vehicle>(static_cast<uint32_t>(_args[1]), _object, false, _args[3]);
|
||||||
vehicles[static_cast<uint32_t>(_args[1])] = _vehicle;
|
vehicles[static_cast<uint32_t>(_args[1])] = _vehicle;
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ namespace ace {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool model_collection::load_model(const std::string & p3d_path) {
|
bool model_collection::load_model(const std::string & p3d_path, std::string &key_name) {
|
||||||
std::string working_path = p3d_path;
|
std::string working_path = p3d_path;
|
||||||
|
|
||||||
// Flag ourselves as unready, because we are loading a model
|
// Flag ourselves as unready, because we are loading a model
|
||||||
@ -91,6 +91,7 @@ namespace ace {
|
|||||||
|
|
||||||
auto iter = _pbo_searcher->file_index().find(working_path);
|
auto iter = _pbo_searcher->file_index().find(working_path);
|
||||||
if (iter != _pbo_searcher->file_index().end()) {
|
if (iter != _pbo_searcher->file_index().end()) {
|
||||||
|
key_name = working_path;
|
||||||
return _load_model(iter->first, iter->second);
|
return _load_model(iter->first, iter->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ namespace ace {
|
|||||||
class model_collection : public singleton<model_collection> {
|
class model_collection : public singleton<model_collection> {
|
||||||
public:
|
public:
|
||||||
model_collection();
|
model_collection();
|
||||||
bool load_model(const std::string & p3d_path);
|
bool load_model(const std::string & p3d_path, std::string & key_name);
|
||||||
|
|
||||||
bool init();
|
bool init();
|
||||||
bool reset();
|
bool reset();
|
||||||
|
Loading…
Reference in New Issue
Block a user