mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Animations nearly aligning correctly.
This commit is contained in:
parent
ac1ae6c596
commit
77614ca015
@ -35,7 +35,7 @@ if(_sendToExtension) then {
|
|||||||
|
|
||||||
_cmd = "set_animation_state:";
|
_cmd = "set_animation_state:";
|
||||||
{
|
{
|
||||||
_cmd = _cmd + format["%1,%2,", (_x select 0), (_x select 1)];
|
_cmd = _cmd + format["%1,%2,", (_x select 0), ([(_x select 1)] call CBA_fnc_formatNumber)];
|
||||||
} forEach _animationResults;
|
} forEach _animationResults;
|
||||||
|
|
||||||
_cmd call FUNC(callExtension);
|
_cmd call FUNC(callExtension);
|
||||||
|
@ -18,4 +18,4 @@
|
|||||||
#define DEBUG_EXTENSION_DYNLOAD
|
#define DEBUG_EXTENSION_DYNLOAD
|
||||||
#define DEBUG_LOG_EXTENSION
|
#define DEBUG_LOG_EXTENSION
|
||||||
//#define DEBUG_EXTENSION_DYNLOAD_RELOAD
|
//#define DEBUG_EXTENSION_DYNLOAD_RELOAD
|
||||||
#define DEBUG_VEHICLEDAMAGE_RENDER
|
//#define DEBUG_VEHICLEDAMAGE_RENDER
|
@ -40,6 +40,9 @@ namespace ace {
|
|||||||
public:
|
public:
|
||||||
arguments(const std::string & str) : _original(str) {
|
arguments(const std::string & str) : _original(str) {
|
||||||
_args = ace::split(str, ',');
|
_args = ace::split(str, ',');
|
||||||
|
for (int i = 0; i < _args.size(); i++) {
|
||||||
|
_args[i] = trim(_args[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t size() const { return _args.size(); }
|
size_t size() const { return _args.size(); }
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
#include "shared.hpp"
|
#include "shared.hpp"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <functional>
|
||||||
|
#include <cctype>
|
||||||
|
#include <locale>
|
||||||
|
|
||||||
int test(int var) {
|
int test(int var) {
|
||||||
return var;
|
return var;
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,23 @@ namespace ace {
|
|||||||
std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems);
|
std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems);
|
||||||
std::vector<std::string> split(const std::string &s, char delim);
|
std::vector<std::string> split(const std::string &s, char delim);
|
||||||
|
|
||||||
|
// trim from start
|
||||||
|
static inline std::string <rim(std::string &s) {
|
||||||
|
s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
// trim from end
|
||||||
|
static inline std::string &rtrim(std::string &s) {
|
||||||
|
s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
// trim from both ends
|
||||||
|
static inline std::string &trim(std::string &s) {
|
||||||
|
return ltrim(rtrim(s));
|
||||||
|
}
|
||||||
|
|
||||||
inline void runtime_assert(bool result);
|
inline void runtime_assert(bool result);
|
||||||
|
|
||||||
struct exception {
|
struct exception {
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
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) : table(_table), vertex_id(_id)
|
||||||
{
|
{
|
||||||
this->original_vertex = _vertex;
|
this->original_vertex = _vertex;
|
||||||
this->animated_vertex = _vertex;
|
this->animated_vertex = _vertex;
|
||||||
}
|
}
|
||||||
|
|
||||||
ace::simulation::vertex::~vertex()
|
ace::simulation::vertex::~vertex()
|
||||||
@ -16,50 +16,50 @@ ace::simulation::vertex::~vertex()
|
|||||||
|
|
||||||
|
|
||||||
ace::simulation::face::face(
|
ace::simulation::face::face(
|
||||||
const ace::p3d::face_p p3d_face,
|
const ace::p3d::face_p p3d_face,
|
||||||
const ace::p3d::lod_p p3d_lod,
|
const ace::p3d::lod_p p3d_lod,
|
||||||
const ace::p3d::model_p p3d,
|
const ace::p3d::model_p p3d,
|
||||||
ace::simulation::lod *object_lod)
|
ace::simulation::lod *object_lod)
|
||||||
{
|
{
|
||||||
this->type = p3d_face->type;
|
this->type = p3d_face->type;
|
||||||
for (uint16_t vertex_id : p3d_face->vertex_table) {
|
for (uint16_t vertex_id : p3d_face->vertex_table) {
|
||||||
this->vertices.push_back(object_lod->vertices[vertex_id]);
|
this->vertices.push_back(object_lod->vertices[vertex_id]);
|
||||||
object_lod->vertices[vertex_id]->faces.push_back(this);
|
object_lod->vertices[vertex_id]->faces.push_back(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ace::simulation::face::~face()
|
ace::simulation::face::~face()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ace::simulation::vertex::animate(const glm::mat4 &matrix, ace::vector3<float> rotation_offset, bool offset)
|
void ace::simulation::vertex::animate(const glm::mat4 &matrix, ace::vector3<float> rotation_offset, bool offset)
|
||||||
{
|
{
|
||||||
ace::vector3<float> temp_vector = this->original_vertex;
|
ace::vector3<float> temp_vector = this->original_vertex;
|
||||||
if (offset) {
|
if (offset) {
|
||||||
temp_vector = temp_vector - rotation_offset;
|
temp_vector = temp_vector - rotation_offset;
|
||||||
}
|
}
|
||||||
glm::vec4 temp_gl_vector = glm::vec4(temp_vector.x(), temp_vector.y(), temp_vector.z(), 1.0f);
|
glm::vec4 temp_gl_vector = glm::vec4(temp_vector.x(), temp_vector.y(), temp_vector.z(), 1.0f);
|
||||||
temp_gl_vector = matrix*temp_gl_vector;
|
temp_gl_vector = matrix*temp_gl_vector;
|
||||||
this->animated_vertex = ace::vector3<float>(temp_gl_vector.x, temp_gl_vector.y, temp_gl_vector.z);
|
this->animated_vertex = ace::vector3<float>(temp_gl_vector.x, temp_gl_vector.y, temp_gl_vector.z);
|
||||||
if (offset) {
|
if (offset) {
|
||||||
// this->animated_vertex = this->animated_vertex + rotation_offset;
|
// this->animated_vertex = this->animated_vertex + rotation_offset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ace::simulation::named_selection::named_selection(
|
ace::simulation::named_selection::named_selection(
|
||||||
const ace::p3d::named_selection_p p3d_selection,
|
const ace::p3d::named_selection_p p3d_selection,
|
||||||
const ace::p3d::lod_p p3d_lod,
|
const ace::p3d::lod_p p3d_lod,
|
||||||
const ace::p3d::model_p p3d,
|
const ace::p3d::model_p p3d,
|
||||||
ace::simulation::lod *object_lod)
|
ace::simulation::lod *object_lod)
|
||||||
{
|
{
|
||||||
this->name = p3d_selection->name;
|
this->name = p3d_selection->name;
|
||||||
for (uint16_t vertex_id : p3d_selection->vertex_table.data) {
|
for (uint16_t vertex_id : p3d_selection->vertex_table.data) {
|
||||||
this->vertices.push_back(object_lod->vertices[vertex_id]);
|
this->vertices.push_back(object_lod->vertices[vertex_id]);
|
||||||
object_lod->vertices[vertex_id]->selections.push_back(this);
|
object_lod->vertices[vertex_id]->selections.push_back(this);
|
||||||
}
|
}
|
||||||
for (uint16_t face_id : p3d_selection->faces.data) {
|
for (uint16_t face_id : p3d_selection->faces.data) {
|
||||||
this->faces.push_back(object_lod->faces[face_id]);
|
this->faces.push_back(object_lod->faces[face_id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ace::simulation::named_selection::~named_selection()
|
ace::simulation::named_selection::~named_selection()
|
||||||
@ -68,10 +68,10 @@ ace::simulation::named_selection::~named_selection()
|
|||||||
|
|
||||||
void ace::simulation::named_selection::animate(const glm::mat4 &matrix, ace::vector3<float> rotation_offset)
|
void ace::simulation::named_selection::animate(const glm::mat4 &matrix, ace::vector3<float> rotation_offset)
|
||||||
{
|
{
|
||||||
bool offset = !rotation_offset.zero_distance();
|
bool offset = !rotation_offset.zero_distance();
|
||||||
for (auto selection_vertex : this->vertices) {
|
for (auto selection_vertex : this->vertices) {
|
||||||
selection_vertex->animate(matrix, rotation_offset, offset);
|
selection_vertex->animate(matrix, rotation_offset, offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -79,21 +79,21 @@ void ace::simulation::named_selection::animate(const glm::mat4 &matrix, ace::vec
|
|||||||
|
|
||||||
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) : animated(false)
|
||||||
{
|
{
|
||||||
this->vertices.resize(p3d_vertex_table->points.size);
|
this->vertices.resize(p3d_vertex_table->points.size);
|
||||||
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 = ace::vector3<float>(
|
ace::vector3<float> new_vertex = ace::vector3<float>(
|
||||||
p3d_vertex_table->points[i].x() + (p3d_lod->autocenter_pos.x()*-1),
|
p3d_vertex_table->points[i].x() + (p3d_lod->autocenter_pos.x()*-1),
|
||||||
p3d_vertex_table->points[i].y() + (p3d_lod->autocenter_pos.y()*-1),
|
p3d_vertex_table->points[i].y() + (p3d_lod->autocenter_pos.y()*-1),
|
||||||
p3d_vertex_table->points[i].z() + (p3d_lod->autocenter_pos.z()*-1)
|
p3d_vertex_table->points[i].z() + (p3d_lod->autocenter_pos.z()*-1)
|
||||||
);
|
);
|
||||||
this->vertices[i] = std::make_shared<vertex>(*this, new_vertex, i);
|
this->vertices[i] = std::make_shared<vertex>(*this, new_vertex, i);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ace::simulation::vertex_table::~vertex_table()
|
ace::simulation::vertex_table::~vertex_table()
|
||||||
@ -102,17 +102,17 @@ 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)
|
||||||
{
|
{
|
||||||
this->id = p3d_lod->id;
|
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);
|
||||||
this->autocenter_pos = p3d_lod->autocenter_pos;
|
this->autocenter_pos = p3d_lod->autocenter_pos;
|
||||||
|
|
||||||
for (ace::p3d::face_p p3d_face : p3d_lod->faces) {
|
for (ace::p3d::face_p p3d_face : p3d_lod->faces) {
|
||||||
this->faces.push_back(std::make_shared<face>(p3d_face, p3d_lod, p3d, this));
|
this->faces.push_back(std::make_shared<face>(p3d_face, p3d_lod, p3d, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ace::p3d::named_selection_p p3d_selection : p3d_lod->selections) {
|
for (ace::p3d::named_selection_p p3d_selection : p3d_lod->selections) {
|
||||||
this->selections[p3d_selection->name] = std::make_shared<named_selection>(p3d_selection, p3d_lod, p3d, this);
|
this->selections[p3d_selection->name] = std::make_shared<named_selection>(p3d_selection, p3d_lod, p3d, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -121,21 +121,21 @@ ace::simulation::lod::~lod()
|
|||||||
}
|
}
|
||||||
|
|
||||||
ace::simulation::lod_animation_info::lod_animation_info(
|
ace::simulation::lod_animation_info::lod_animation_info(
|
||||||
animation *_animation,
|
animation *_animation,
|
||||||
lod_p _lod,
|
lod_p _lod,
|
||||||
const ace::p3d::animate_bone_p p3d_animate_bone,
|
const ace::p3d::animate_bone_p p3d_animate_bone,
|
||||||
const ace::p3d::animation_p p3d_animation,
|
const ace::p3d::animation_p p3d_animation,
|
||||||
const ace::p3d::model_p p3d) : animation_definition(_animation), lod(_lod)
|
const ace::p3d::model_p p3d) : animation_definition(_animation), lod(_lod)
|
||||||
{
|
{
|
||||||
this->index = p3d_animate_bone->index;
|
this->index = p3d_animate_bone->index;
|
||||||
if (p3d->info->autocenter) {
|
if (p3d->info->autocenter) {
|
||||||
this->axis_position = p3d_animate_bone->axis_position + (lod->autocenter_pos*-1);
|
this->axis_position = p3d_animate_bone->axis_position + (lod->autocenter_pos*-1);
|
||||||
this->axis_direction = p3d_animate_bone->axis_direction.normalize();
|
this->axis_direction = p3d_animate_bone->axis_direction.normalize();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this->axis_position = p3d_animate_bone->axis_position;
|
this->axis_position = p3d_animate_bone->axis_position;
|
||||||
this->axis_direction = p3d_animate_bone->axis_direction.normalize();
|
this->axis_direction = p3d_animate_bone->axis_direction.normalize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ace::simulation::lod_animation_info::~lod_animation_info()
|
ace::simulation::lod_animation_info::~lod_animation_info()
|
||||||
@ -144,54 +144,54 @@ ace::simulation::lod_animation_info::~lod_animation_info()
|
|||||||
|
|
||||||
ace::simulation::animation::animation(object *parent_object, const ace::p3d::animation_p p3d_animation, const ace::p3d::model_p p3d)
|
ace::simulation::animation::animation(object *parent_object, const ace::p3d::animation_p p3d_animation, const ace::p3d::model_p p3d)
|
||||||
{
|
{
|
||||||
this->type = p3d_animation->type;
|
this->type = p3d_animation->type;
|
||||||
this->name = p3d_animation->name;
|
this->name = p3d_animation->name;
|
||||||
this->source = p3d_animation->source;
|
this->source = p3d_animation->source;
|
||||||
|
|
||||||
this->source_address = p3d_animation->source_address;
|
this->source_address = p3d_animation->source_address;
|
||||||
|
|
||||||
this->min_value = p3d_animation->min_value;
|
this->min_value = p3d_animation->min_value;
|
||||||
this->max_value = p3d_animation->max_value;
|
this->max_value = p3d_animation->max_value;
|
||||||
|
|
||||||
this->min_phase = p3d_animation->min_phase;
|
this->min_phase = p3d_animation->min_phase;
|
||||||
this->max_phase = p3d_animation->max_phase;
|
this->max_phase = p3d_animation->max_phase;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
// rotations
|
// rotations
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
angle0 = p3d_animation->angle0;
|
angle0 = p3d_animation->angle0;
|
||||||
angle1 = p3d_animation->angle1;
|
angle1 = p3d_animation->angle1;
|
||||||
break;
|
break;
|
||||||
// translations
|
// translations
|
||||||
case 4:
|
case 4:
|
||||||
case 5:
|
case 5:
|
||||||
case 6:
|
case 6:
|
||||||
case 7:
|
case 7:
|
||||||
offset0 = p3d_animation->offset0;
|
offset0 = p3d_animation->offset0;
|
||||||
offset1 = p3d_animation->offset1;
|
offset1 = p3d_animation->offset1;
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
direct_axis_pos = p3d_animation->direct_axis_pos;
|
direct_axis_pos = p3d_animation->direct_axis_pos;
|
||||||
direct_axis_dir = p3d_animation->direct_axis_dir;
|
direct_axis_dir = p3d_animation->direct_axis_dir;
|
||||||
direct_angle = p3d_animation->direct_angle;
|
direct_angle = p3d_animation->direct_angle;
|
||||||
direct_axis_offset = p3d_animation->direct_axis_offset;
|
direct_axis_offset = p3d_animation->direct_axis_offset;
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
hide_value = p3d_animation->hide_value;
|
hide_value = p3d_animation->hide_value;
|
||||||
default:
|
default:
|
||||||
offset0 = 0.0f;
|
offset0 = 0.0f;
|
||||||
offset1 = 0.0f;
|
offset1 = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (ace::p3d::animate_bone_p animation_bone : p3d_animation->bones) {
|
for (ace::p3d::animate_bone_p animation_bone : p3d_animation->bones) {
|
||||||
this->lod_info[animation_bone->lod] = std::make_shared<lod_animation_info>(this, parent_object->lods[animation_bone->lod], animation_bone, p3d_animation, p3d);
|
this->lod_info[animation_bone->lod] = std::make_shared<lod_animation_info>(this, parent_object->lods[animation_bone->lod], animation_bone, p3d_animation, p3d);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,10 +200,10 @@ ace::simulation::animation::~animation()
|
|||||||
}
|
}
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
float f;
|
float f;
|
||||||
struct {
|
struct {
|
||||||
uint32_t sh1 : 32;
|
uint32_t sh1 : 32;
|
||||||
} parts;
|
} parts;
|
||||||
} double_cast;
|
} double_cast;
|
||||||
|
|
||||||
#define RAD2DEG(rad) (rad * 180.0f / 3.1415926f);
|
#define RAD2DEG(rad) (rad * 180.0f / 3.1415926f);
|
||||||
@ -211,176 +211,197 @@ typedef union {
|
|||||||
typedef std::map<uint32_t, std::pair<glm::mat4, ace::vector3<float>>> animation_transform;
|
typedef std::map<uint32_t, std::pair<glm::mat4, ace::vector3<float>>> animation_transform;
|
||||||
animation_transform ace::simulation::animation::animate(const float phase, const std::vector<uint32_t> &lods, animation_transform base_transforms)
|
animation_transform ace::simulation::animation::animate(const float phase, const std::vector<uint32_t> &lods, animation_transform base_transforms)
|
||||||
{
|
{
|
||||||
animation_transform return_matrices;
|
animation_transform return_matrices;
|
||||||
for (auto lod_id : lods) {
|
for (auto lod_id : lods) {
|
||||||
glm::mat4 base_matrix = base_transforms[lod_id].first;
|
glm::mat4 base_matrix = base_transforms[lod_id].first;
|
||||||
ace::vector3<float> base_rotation_offset = base_transforms[lod_id].second;
|
ace::vector3<float> base_rotation_offset = base_transforms[lod_id].second;
|
||||||
glm::mat4 animation_matrix, direction_matrix;
|
glm::mat4 animation_matrix, direction_matrix;
|
||||||
ace::vector3<float> rotation_offset = ace::vector3<float>(0, 0, 0);
|
ace::vector3<float> rotation_offset = ace::vector3<float>(0, 0, 0);
|
||||||
|
|
||||||
float scale = get_scale(phase);
|
float scale = get_scale(phase);
|
||||||
|
|
||||||
switch (this->type) {
|
glm::vec3 axis_position = glm::vec3(this->lod_info[lod_id]->axis_position.x(), this->lod_info[lod_id]->axis_position.y(), this->lod_info[lod_id]->axis_position.z());
|
||||||
//rotation
|
glm::vec3 axis_direction = glm::vec3(this->lod_info[lod_id]->axis_direction.x(), this->lod_info[lod_id]->axis_direction.y(), this->lod_info[lod_id]->axis_direction.z());
|
||||||
case 0: {
|
|
||||||
scale = (scale / (max_value - min_value)) * (angle1 - angle0);
|
|
||||||
glm::vec3 rotation_axis = glm::vec3(this->lod_info[lod_id]->axis_position.x(), this->lod_info[lod_id]->axis_position.y(), this->lod_info[lod_id]->axis_position.z());
|
|
||||||
glm::vec3 rotation_direction = glm::vec3(this->lod_info[lod_id]->axis_direction.x(), this->lod_info[lod_id]->axis_direction.y(), this->lod_info[lod_id]->axis_direction.z());
|
|
||||||
|
|
||||||
animation_matrix = glm::rotate(glm::mat4(1.0f), scale, rotation_direction);
|
|
||||||
direction_matrix = glm::translate(glm::mat4(1.0f), rotation_axis);
|
|
||||||
animation_matrix = animation_matrix * direction_matrix;
|
|
||||||
|
|
||||||
rotation_offset = this->lod_info[lod_id]->axis_position;
|
if (true) {
|
||||||
break;
|
switch (this->type) {
|
||||||
}
|
//rotation
|
||||||
//rotationX
|
case 0: {
|
||||||
case 1: {
|
scale = (scale / (max_value - min_value)) * (angle1 - angle0);
|
||||||
scale = (scale / (max_value - min_value)) * (angle1 - angle0);
|
|
||||||
glm::vec3 rotation_axis = glm::vec3(1.0f, 0.0f, 0.0f);
|
animation_matrix = glm::rotate(glm::mat4(1.0f), scale, axis_direction);
|
||||||
animation_matrix = glm::rotate(animation_matrix, scale, rotation_axis);
|
direction_matrix = glm::translate(glm::mat4(1.0f), axis_position);
|
||||||
rotation_offset = this->lod_info[lod_id]->axis_position;
|
|
||||||
break;
|
animation_matrix = animation_matrix * direction_matrix;
|
||||||
}
|
|
||||||
//rotationY
|
rotation_offset = this->lod_info[lod_id]->axis_position;
|
||||||
case 2: {
|
break;
|
||||||
scale = (scale / (max_value - min_value)) * (angle1 - angle0);
|
}
|
||||||
glm::vec3 rotation_axis = glm::vec3(0.0f, 1.0f, 0.0f);
|
//rotationX
|
||||||
animation_matrix = glm::rotate(animation_matrix, scale, rotation_axis);
|
case 1: {
|
||||||
rotation_offset = this->lod_info[lod_id]->axis_position;
|
scale = (scale / (max_value - min_value)) * (angle1 - angle0);
|
||||||
break;
|
glm::vec3 rotation_axis = glm::vec3(1.0f, 0.0f, 0.0f);
|
||||||
}
|
|
||||||
//rotationZ
|
animation_matrix = glm::rotate(glm::mat4(1.0f), scale, rotation_axis);
|
||||||
case 3: {
|
direction_matrix = glm::translate(glm::mat4(1.0f), axis_position);
|
||||||
scale = (scale / (max_value - min_value)) * (angle1 - angle0);
|
|
||||||
glm::vec3 rotation_axis = glm::vec3(0.0f, 0.0f, 1.0f);
|
animation_matrix = animation_matrix * direction_matrix;
|
||||||
animation_matrix = glm::rotate(animation_matrix, scale, rotation_axis);
|
|
||||||
rotation_offset = this->lod_info[lod_id]->axis_position;
|
rotation_offset = this->lod_info[lod_id]->axis_position;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//translation
|
//rotationY
|
||||||
case 4: {
|
case 2: {
|
||||||
scale = (scale / (max_value - min_value)) * (offset1 - offset0);
|
scale = (scale / (max_value - min_value)) * (angle1 - angle0);
|
||||||
animation_matrix = glm::translate(animation_matrix, glm::vec3(
|
glm::vec3 rotation_axis = glm::vec3(0.0f, 1.0f, 0.0f);
|
||||||
this->lod_info[lod_id]->axis_direction.x()*scale,
|
|
||||||
this->lod_info[lod_id]->axis_direction.y()*scale,
|
animation_matrix = glm::rotate(glm::mat4(1.0f), scale, rotation_axis);
|
||||||
this->lod_info[lod_id]->axis_direction.z()*scale
|
direction_matrix = glm::translate(glm::mat4(1.0f), axis_position);
|
||||||
));
|
|
||||||
|
animation_matrix = animation_matrix * direction_matrix;
|
||||||
break;
|
|
||||||
}
|
rotation_offset = this->lod_info[lod_id]->axis_position;
|
||||||
//translationX
|
break;
|
||||||
case 5: {
|
}
|
||||||
animation_matrix = glm::translate(animation_matrix, glm::vec3(
|
//rotationZ
|
||||||
scale,
|
case 3: {
|
||||||
0.0f,
|
scale = (scale / (max_value - min_value)) * (angle1 - angle0);
|
||||||
0.0f
|
glm::vec3 rotation_axis = glm::vec3(0.0f, 0.0f, 1.0f);
|
||||||
));
|
|
||||||
break;
|
animation_matrix = glm::rotate(glm::mat4(1.0f), scale, rotation_axis);
|
||||||
}
|
direction_matrix = glm::translate(glm::mat4(1.0f), axis_position);
|
||||||
//translationY
|
|
||||||
case 6: {
|
animation_matrix = animation_matrix * direction_matrix;
|
||||||
animation_matrix = glm::translate(animation_matrix, glm::vec3(
|
|
||||||
0.0f,
|
rotation_offset = this->lod_info[lod_id]->axis_position;
|
||||||
scale,
|
break;
|
||||||
0.0f
|
}
|
||||||
));
|
//translation
|
||||||
break;
|
case 4: {
|
||||||
}
|
scale = (scale / (max_value - min_value)) * (offset1 - offset0);
|
||||||
//translationZ
|
animation_matrix = glm::translate(glm::mat4(1.0f), glm::vec3(
|
||||||
case 7: {
|
this->lod_info[lod_id]->axis_direction.x()*scale,
|
||||||
animation_matrix = glm::translate(animation_matrix, glm::vec3(
|
this->lod_info[lod_id]->axis_direction.y()*scale,
|
||||||
0.0f,
|
this->lod_info[lod_id]->axis_direction.z()*scale
|
||||||
0.0f,
|
));
|
||||||
scale
|
break;
|
||||||
));
|
}
|
||||||
break;
|
//translationX
|
||||||
}
|
case 5: {
|
||||||
case 8: {
|
scale = (scale / (max_value - min_value)) * (offset1 - offset0);
|
||||||
// fuck direct for now
|
animation_matrix = glm::translate(animation_matrix, glm::vec3(
|
||||||
}
|
scale,
|
||||||
//hide
|
0.0f,
|
||||||
case 9: {
|
0.0f
|
||||||
if(phase >= hide_value)
|
));
|
||||||
animation_matrix = glm::mat4x4(0.0f);
|
break;
|
||||||
break;
|
}
|
||||||
}
|
//translationY
|
||||||
default: {}
|
case 6: {
|
||||||
}
|
scale = (scale / (max_value - min_value)) * (offset1 - offset0);
|
||||||
return_matrices[lod_id].first = animation_matrix * base_matrix;
|
animation_matrix = glm::translate(animation_matrix, glm::vec3(
|
||||||
return_matrices[lod_id].second = base_rotation_offset + rotation_offset;
|
0.0f,
|
||||||
}
|
scale,
|
||||||
return return_matrices;
|
0.0f
|
||||||
|
));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//translationZ
|
||||||
|
case 7: {
|
||||||
|
scale = (scale / (max_value - min_value)) * (offset1 - offset0);
|
||||||
|
animation_matrix = glm::translate(animation_matrix, glm::vec3(
|
||||||
|
0.0f,
|
||||||
|
0.0f,
|
||||||
|
scale
|
||||||
|
));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 8: {
|
||||||
|
// fuck direct for now
|
||||||
|
}
|
||||||
|
//hide
|
||||||
|
case 9: {
|
||||||
|
if (phase >= hide_value)
|
||||||
|
animation_matrix = glm::mat4x4(0.0f);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {}
|
||||||
|
}
|
||||||
|
return_matrices[lod_id].first = animation_matrix * base_matrix;
|
||||||
|
return_matrices[lod_id].second = base_rotation_offset + rotation_offset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return return_matrices;
|
||||||
}
|
}
|
||||||
|
|
||||||
float ace::simulation::animation::get_scale(float phase)
|
float ace::simulation::animation::get_scale(float phase)
|
||||||
{
|
{
|
||||||
float scale = 0;
|
float scale = 0;
|
||||||
|
|
||||||
|
|
||||||
switch (source_address)
|
switch (source_address)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
scale = fmod(phase - min_value, max_value - min_value) + min_value;
|
scale = fmod(phase - min_value, max_value - min_value) + min_value;
|
||||||
scale = std::min(std::max(scale, min_phase), max_phase);
|
scale = std::min(std::max(scale, min_phase), max_phase);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
scale = fmod(phase - min_value, (max_value - min_value) * 2) + min_value;
|
scale = fmod(phase - min_value, (max_value - min_value) * 2) + min_value;
|
||||||
if (scale > max_value) scale = max_value - (scale - max_value);
|
if (scale > max_value) scale = max_value - (scale - max_value);
|
||||||
scale = std::min(std::max(scale, min_phase), max_phase);
|
scale = std::min(std::max(scale, min_phase), max_phase);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
scale = std::min(std::max(phase, min_phase), max_phase);
|
scale = std::min(std::max(phase, min_phase), max_phase);
|
||||||
}
|
}
|
||||||
|
|
||||||
return scale;
|
return scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
ace::simulation::bone::bone(
|
ace::simulation::bone::bone(
|
||||||
const std::string _name,
|
const std::string _name,
|
||||||
const std::vector<std::string> &children,
|
const std::vector<std::string> &children,
|
||||||
const std::map<std::string, ace::p3d::bone_p> &p3d_bones,
|
const std::map<std::string, ace::p3d::bone_p> &p3d_bones,
|
||||||
bone *_parent,
|
bone *_parent,
|
||||||
const ace::p3d::model_p p3d,
|
const ace::p3d::model_p p3d,
|
||||||
object * sim_object
|
object * sim_object
|
||||||
) : parent(_parent), name(_name), base_object(sim_object)
|
) : parent(_parent), name(_name), base_object(sim_object)
|
||||||
{
|
{
|
||||||
for (auto const child_bone : children) {
|
for (auto const child_bone : children) {
|
||||||
if (sim_object->all_bones.find(child_bone) == sim_object->all_bones.end()) {
|
if (sim_object->all_bones.find(child_bone) == sim_object->all_bones.end()) {
|
||||||
ace::p3d::bone_p p3d_bone = p3d_bones.find(child_bone)->second;
|
ace::p3d::bone_p p3d_bone = p3d_bones.find(child_bone)->second;
|
||||||
sim_object->all_bones[child_bone] = std::make_shared<bone>(p3d_bone->name, p3d_bone->children, p3d_bones, this, p3d, sim_object);
|
sim_object->all_bones[child_bone] = std::make_shared<bone>(p3d_bone->name, p3d_bone->children, p3d_bones, this, p3d, sim_object);
|
||||||
}
|
}
|
||||||
this->children.push_back(sim_object->all_bones[child_bone]);
|
this->children.push_back(sim_object->all_bones[child_bone]);
|
||||||
}
|
}
|
||||||
if (parent) {
|
if (parent) {
|
||||||
for (auto p3d_animation : p3d_bones.find(name)->second->animations) {
|
for (auto p3d_animation : p3d_bones.find(name)->second->animations) {
|
||||||
this->animations.push_back(sim_object->animations[p3d_animation]);
|
this->animations.push_back(sim_object->animations[p3d_animation]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ace::simulation::bone::animate(const std::map<std::string, float> &animation_state, const std::vector<uint32_t> &lods, animation_transform base_transforms)
|
void ace::simulation::bone::animate(const std::map<std::string, float> &animation_state, const std::vector<uint32_t> &lods, animation_transform base_transforms)
|
||||||
{
|
{
|
||||||
if (animations.size() > 0) {
|
if (animations.size() > 0) {
|
||||||
for (auto bone_animation : animations) {
|
for (auto bone_animation : animations) {
|
||||||
if(animation_state.find(bone_animation->name) != animation_state.end()) {
|
if (animation_state.find(bone_animation->name) != animation_state.end()) {
|
||||||
base_transforms = bone_animation->animate(animation_state.find(bone_animation->name)->second, lods, base_transforms);
|
base_transforms = bone_animation->animate(animation_state.find(bone_animation->name)->second, lods, base_transforms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (auto child_bone : children) {
|
for (auto child_bone : children) {
|
||||||
child_bone->animate(animation_state, lods, base_transforms);
|
child_bone->animate(animation_state, lods, base_transforms);
|
||||||
}
|
}
|
||||||
if(animations.size() > 0) {
|
if (animations.size() > 0) {
|
||||||
for (auto bone_animation : animations) {
|
for (auto bone_animation : animations) {
|
||||||
for (auto lod_id : lods) {
|
for (auto lod_id : lods) {
|
||||||
auto selection = this->base_object->lods[lod_id]->selections.find(this->name);
|
auto selection = this->base_object->lods[lod_id]->selections.find(this->name);
|
||||||
if(selection != this->base_object->lods[lod_id]->selections.end()) {
|
if (selection != this->base_object->lods[lod_id]->selections.end()) {
|
||||||
selection->second->animate(base_transforms[lod_id].first, base_transforms[lod_id].second);
|
selection->second->animate(base_transforms[lod_id].first, base_transforms[lod_id].second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ace::simulation::object::object()
|
ace::simulation::object::object()
|
||||||
@ -389,27 +410,27 @@ ace::simulation::object::object()
|
|||||||
|
|
||||||
ace::simulation::object::object(const ace::p3d::model_p model)
|
ace::simulation::object::object(const ace::p3d::model_p model)
|
||||||
{
|
{
|
||||||
for (ace::p3d::lod_p p3d_lod : model->lods) {
|
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);
|
||||||
this->lods.push_back(new_lod);
|
this->lods.push_back(new_lod);
|
||||||
this->lods[p3d_lod->id]->type = model->info->resolutions[p3d_lod->id];
|
this->lods[p3d_lod->id]->type = model->info->resolutions[p3d_lod->id];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ace::p3d::animation_p p3d_animation : model->animations) {
|
for (ace::p3d::animation_p p3d_animation : model->animations) {
|
||||||
this->animations.push_back(std::make_shared<animation>(this, p3d_animation, model));
|
this->animations.push_back(std::make_shared<animation>(this, p3d_animation, model));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<std::string, ace::p3d::bone_p> p3d_bones;
|
std::map<std::string, ace::p3d::bone_p> p3d_bones;
|
||||||
for (auto const skeleton_bone : model->skeleton->all_bones) {
|
for (auto const skeleton_bone : model->skeleton->all_bones) {
|
||||||
p3d_bones[skeleton_bone->name] = skeleton_bone;
|
p3d_bones[skeleton_bone->name] = skeleton_bone;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> root_bones;
|
std::vector<std::string> root_bones;
|
||||||
for (auto const root_bone : model->skeleton->root_bones) {
|
for (auto const root_bone : model->skeleton->root_bones) {
|
||||||
root_bones.push_back(root_bone.first);
|
root_bones.push_back(root_bone.first);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->root_bone = std::make_shared<bone>("", root_bones, p3d_bones, nullptr, model, this);
|
this->root_bone = std::make_shared<bone>("", root_bones, p3d_bones, nullptr, model, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -421,12 +442,12 @@ ace::simulation::object::~object()
|
|||||||
|
|
||||||
void ace::simulation::object::animate(const std::map<std::string, float> &animation_state, const std::vector<uint32_t> &selected_lods)
|
void ace::simulation::object::animate(const std::map<std::string, float> &animation_state, const std::vector<uint32_t> &selected_lods)
|
||||||
{
|
{
|
||||||
animation_transform identity_transform;
|
animation_transform identity_transform;
|
||||||
for (uint32_t lod_id : selected_lods) {
|
for (uint32_t lod_id : selected_lods) {
|
||||||
identity_transform[lod_id].first = glm::mat4();
|
identity_transform[lod_id].first = glm::mat4();
|
||||||
identity_transform[lod_id].second = ace::vector3<float>(0, 0, 0);
|
identity_transform[lod_id].second = ace::vector3<float>(0, 0, 0);
|
||||||
}
|
}
|
||||||
this->root_bone->animate(animation_state, selected_lods, identity_transform);
|
this->root_bone->animate(animation_state, selected_lods, identity_transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,5 +69,11 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getchar();
|
while (true) {
|
||||||
|
scanf_s("%s", buffer, sizeof(buffer) - 1);
|
||||||
|
memset(output, 0x00, sizeof(output));
|
||||||
|
LOG(INFO) << "Executing: '" << buffer << "'";
|
||||||
|
RVExtension(output, sizeof(output), buffer);
|
||||||
|
LOG(INFO) << "Result: '" << output << "'";
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,9 +1,5 @@
|
|||||||
|
#c:\arma\arma3\addons\armor_f_epb.pbo C:\dev\ace3\extensions\tests\longrod_dxtk_test.txt
|
||||||
init:
|
init:
|
||||||
debug_render:
|
debug_render:
|
||||||
register_vehicle:\A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d, 1, 4046.21;3902.56;5.075
|
register_vehicle:\A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d, 1, 4046.21;3902.56;5.075
|
||||||
#set_animation_state:damageHide, 0, Wheel_kolL1, 4.45242e-005, Wheel_koloL1, 4.45242e-005, Wheel_podkoloL1, 0.520781, Wheel_kolP1, 4.45066e-005, Wheel_koloP1, 4.45066e-005, Wheel_podkoloP1, 0.521964, Wheel_kolL2, 4.45242e-005, Wheel_kolP2, 4.45066e-005, Wheel_koloL2, 4.45242e-005, Wheel_koloL3, 4.45242e-005, Wheel_koloL4, 4.45242e-005, Wheel_koloL5, 4.45242e-005, Wheel_koloL6, 4.45242e-005, Wheel_koloL7, 4.45242e-005, Wheel_koloP2, 4.45066e-005, Wheel_koloP3, 4.45066e-005, Wheel_koloP4, 4.45066e-005, Wheel_koloP5, 4.45066e-005, Wheel_koloP6, 4.45066e-005, Wheel_koloP7, 4.45066e-005, Wheel_podkoloL2, 0.507025, Wheel_podkoloL3, 0.500526, Wheel_podkoloL4, 0.509195, Wheel_podkoloL5, 0.49289, Wheel_podkoloL6, 0.48161, Wheel_podkoloP2, 0.513542, Wheel_podkoloP3, 0.507042, Wheel_podkoloP4, 0.500768, Wheel_podkoloP5, 0.496353, Wheel_podkoloP6, 0.503705, podkoloL1_hide_damage, 0, podkoloL2_hide_damage, 0, podkoloL3_hide_damage, 0, podkoloL4_hide_damage, 0, podkoloL5_hide_damage, 0, podkoloL6_hide_damage, 0, podkoloL7_hide_damage, 0, podkoloL8_hide_damage, 0, podkoloP1_hide_damage, 0, podkoloP2_hide_damage, 0, podkoloP3_hide_damage, 0, podkoloP4_hide_damage, 0, podkoloP5_hide_damage, 0, podkoloP6_hide_damage, 0, podkoloP7_hide_damage, 0, podkoloP8_hide_damage, 0, damageVez, 0, MainTurret, 2.37036, MainGun, 0.347653, Recoil, 0, ObsTurret, 0, ObsGun, 0, MainGunOptics, 0.347653, Wheel_podkoloP7, 0.493503, Wheel_podkoloL7, 0.479849, HatchDriver, 0, HatchCommander, 0, HatchGunner, 0, damageVezVelitele, 0, poklop_commander_damage, 0, poklop_gunner_damage, 0, poklop_driver_damage, 0, zaslehROT_HMG, 0, zaslehROT_coax, 14.094, cannon_muzzle_flash, 0, zaslehROT_cannon, 18, HideHull, 0.303806, HideTurret, 0.0209581, LockMuzzle, 0,
|
set_animation_state:1,damageHide, 0, Wheel_kolL1, 0, Wheel_koloL1, 0, Wheel_podkoloL1, 1, Wheel_kolP1, 0, Wheel_koloP1, 0, Wheel_podkoloP1, 1, Wheel_kolL2, 0, Wheel_kolP2, 0, Wheel_koloL2, 0, Wheel_koloL3, 0, Wheel_koloL4, 0, Wheel_koloL5, 0, Wheel_koloL6, 0, Wheel_koloL7, 0, Wheel_koloP2, 0, Wheel_koloP3, 0, Wheel_koloP4, 0, Wheel_koloP5, 0, Wheel_koloP6, 0, Wheel_koloP7, 0, Wheel_podkoloL2, 1, Wheel_podkoloL3, 1, Wheel_podkoloL4, 1, Wheel_podkoloL5, 0, Wheel_podkoloL6, 0, Wheel_podkoloP2, 1, Wheel_podkoloP3, 1, Wheel_podkoloP4, 1, Wheel_podkoloP5, 0, Wheel_podkoloP6, 1, podkoloL1_hide_damage, 0, podkoloL2_hide_damage, 0, podkoloL3_hide_damage, 0, podkoloL4_hide_damage, 0, podkoloL5_hide_damage, 0, podkoloL6_hide_damage, 0, podkoloL7_hide_damage, 0, podkoloL8_hide_damage, 0, podkoloP1_hide_damage, 0, podkoloP2_hide_damage, 0, podkoloP3_hide_damage, 0, podkoloP4_hide_damage, 0, podkoloP5_hide_damage, 0, podkoloP6_hide_damage, 0, podkoloP7_hide_damage, 0, podkoloP8_hide_damage, 0, damageVez, 0, MainTurret, -3, MainGun, 0, Recoil, 0, ObsTurret, -0, ObsGun, 0, MainGunOptics, 0, Wheel_podkoloP7, 0, Wheel_podkoloL7, 0, HatchDriver, 0, HatchCommander, 0, HatchGunner, 0, damageVezVelitele, 0, poklop_commander_damage, 0, poklop_gunner_damage, 0, poklop_driver_damage, 0, zaslehROT_HMG, 101, zaslehROT_coax, 16, cannon_muzzle_flash, 0, zaslehROT_cannon, 956, HideHull, 1, HideTurret, 1, LockMuzzle, 0
|
||||||
#hit:1, \A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d, ["damagehide"], 0.984803;0.173649;-0.00285841, 0.0029445;-0.000238176;0.999996, 2, Sh_120mm_APFSDS_Tracer_Yellow, 65, 27, 0, 0, 0, -108.073;1739.99;-17.7792, -18.9268;0.0336914;-1.73933, -0.0619889;0.998028;-0.00989257, 0.173648;-0.984808;-0.000745866
|
|
||||||
hit:1, \A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d, [], 0.984803;0.173649;-0.00285841, 0.0029445;-0.000238176;0.999996, 2, Sh_120mm_APFSDS_Tracer_Yellow, 65, 27, 0, 0, 0, -107.792;1724.28;-18.3618, -18.9268;0.0336914;-1.73933, -0.0619889;0.998028;-0.00989257, 0.173648;-0.984808;-0.000746796
|
|
||||||
#hit:1, \A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d, [], 0.984803;0.173649;-0.00285841, 0.0029445;-0.000238176;0.999996, 2, Sh_120mm_APFSDS_Tracer_Yellow, 65, 27, 0, 0, 0, -106.921;1703.28;-19.728, -18.9268;0.0336914;-1.73933, -0.0619889;0.998028;-0.00989257, 0.173648;-0.984808;-0.000745866
|
|
||||||
#hit:1, \A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d, [], 0.984803;0.173649;-0.00285841, 0.0029445;-0.000238176;0.999996, 2, Sh_120mm_APFSDS_Tracer_Yellow, 65, 27, 0, 0, 0, -92.8136;1569.56;-19.7856, -18.9268;0.0336914;-1.73933, -0.0619889;0.998028;-0.00989257, 0.173648;-0.984808;-0.000746472
|
|
||||||
#hit:1, \A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d, ["damagehide"], 0.984803;0.173649;-0.00285841, 0.0029445;-0.000238176;0.999996, 2, Sh_120mm_APFSDS_Tracer_Yellow, 65, 27, 0, 0, 0, -76.7551;1435.97;-17.8176, -18.9268;0.0336914;-1.73933, -0.0619889;0.998028;-0.00989257, 0.173648;-0.984808;-0.000745866
|
|
@ -1,5 +1,6 @@
|
|||||||
|
#c:\arma\arma3\addons\structures_f_ind.pbo C:\dev\ace3\extensions\tests\longrod_dxtk_test.txt.backup
|
||||||
init:
|
init:
|
||||||
debug_render:
|
debug_render:
|
||||||
register_vehicle:\A3\Structures_F\Ind\Cargo\Cargo40_blue_F.p3d,0,4050.18;3802.55;5.075
|
register_vehicle:\A3\Structures_F\Ind\Cargo\Cargo40_blue_F.p3d,0,4050.18;3802.55;5.075
|
||||||
set_animation_state:Door_1_rot,1,Door_Locked_1_rot,0,Door_2_rot,0,Door_Locked_2_rot,0,
|
set_animation_state:0,Door_1_rot,0,Door_Locked_1_rot,0,Door_2_rot,0,Door_Locked_2_rot,0,
|
||||||
fetch_result:1
|
fetch_result:1
|
Binary file not shown.
@ -1,3 +1,5 @@
|
|||||||
|
# C:\dev\ace3\extensions\tests\test.pbo C:\dev\ace3\extensions\tests\test.pbo.txt
|
||||||
init:
|
init:
|
||||||
debug_render:
|
debug_render:
|
||||||
register_vehicle:\test\test.p3d,2,4050.18;3802.55;5.075
|
register_vehicle:\test\test.p3d,0,4050.18;3802.55;5.075
|
||||||
|
set_animation_state:0,box3_rotate,0.5,box3_translate,0,
|
@ -18,7 +18,7 @@ class CfgVehicles {
|
|||||||
author = "Nou";
|
author = "Nou";
|
||||||
_generalMacro = "nou_snow_2x2";
|
_generalMacro = "nou_snow_2x2";
|
||||||
scope = 2;
|
scope = 2;
|
||||||
model = "\x\nou\addons\test_model\test.p3d";
|
model = "test_model\test.p3d";
|
||||||
vehicleClass = "Structures";
|
vehicleClass = "Structures";
|
||||||
cost = 50000;
|
cost = 50000;
|
||||||
replaceDamagedLimit = 0.99999;
|
replaceDamagedLimit = 0.99999;
|
||||||
|
@ -20,9 +20,10 @@ namespace ace {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fire_lod == -1) // @TODO: fallback on geo LOD
|
if (fire_lod == -1) // @TODO: fallback on geo LOD
|
||||||
fire_lod = 11;
|
fire_lod = 0;
|
||||||
|
//fire_lod = 0;
|
||||||
assert(fire_lod != -1);
|
assert(fire_lod != -1);
|
||||||
|
|
||||||
// Build the mesh from object faces
|
// Build the mesh from object faces
|
||||||
// TODO: LOD!?
|
// TODO: LOD!?
|
||||||
// P3d store in x,z,y format
|
// P3d store in x,z,y format
|
||||||
@ -58,7 +59,7 @@ namespace ace {
|
|||||||
std::vector<uint32_t> lods;
|
std::vector<uint32_t> lods;
|
||||||
lods.push_back(fire_lod);
|
lods.push_back(fire_lod);
|
||||||
|
|
||||||
object->animate(animation_state, lods);
|
object->animate(animation_state, lods);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ namespace ace {
|
|||||||
if (vehicles.find(id) == vehicles.end())
|
if (vehicles.find(id) == vehicles.end())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (int x = 0, y = 0; x < vehicles[id]->animation_state.size() && x < _args.size() / 2; x++, y +=2) {
|
for (int x = 1, y = 1; x < vehicles[id]->animation_state.size() && x < _args.size() / 2; x++, y +=2) {
|
||||||
std::string animation_name = _args[y];
|
std::string animation_name = _args[y];
|
||||||
float state = _args[y + 1];
|
float state = _args[y + 1];
|
||||||
vehicles[id]->animation_state[animation_name] = state;
|
vehicles[id]->animation_state[animation_name] = state;
|
||||||
|
Loading…
Reference in New Issue
Block a user