mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
scale, rotation and translation work; still not working. Back compat for v60 p3d's fully implemented.
This commit is contained in:
parent
77614ca015
commit
30c84efe61
@ -43,7 +43,7 @@ namespace ace {
|
|||||||
stream_.read((char *)&u_float_1, sizeof(float));
|
stream_.read((char *)&u_float_1, sizeof(float));
|
||||||
|
|
||||||
// Derp, this was only TOH apparently!?
|
// Derp, this was only TOH apparently!?
|
||||||
//point_flags = compressed<uint32_t>(stream_, true, true);
|
//point_flags = compressed<uint32_t>(stream_, true, true, version);
|
||||||
|
|
||||||
stream_.read((char *)&u_float_2, sizeof(float));
|
stream_.read((char *)&u_float_2, sizeof(float));
|
||||||
stream_.read((char *)&u_float_3, sizeof(float));
|
stream_.read((char *)&u_float_3, sizeof(float));
|
||||||
@ -70,8 +70,8 @@ namespace ace {
|
|||||||
materials.push_back(std::make_shared<material>(stream_, version));
|
materials.push_back(std::make_shared<material>(stream_, version));
|
||||||
}
|
}
|
||||||
|
|
||||||
edges.mlod = compressed<uint16_t>(stream_, true, false).data;
|
edges.mlod = compressed<uint16_t>(stream_, true, false, version).data;
|
||||||
edges.vertex = compressed<uint16_t>(stream_, true, false).data;
|
edges.vertex = compressed<uint16_t>(stream_, true, false, version).data;
|
||||||
|
|
||||||
// @TODO: THIS IS OFF WTF?!
|
// @TODO: THIS IS OFF WTF?!
|
||||||
// The first face is coming up null, so we missed something
|
// The first face is coming up null, so we missed something
|
||||||
@ -128,14 +128,14 @@ namespace ace {
|
|||||||
uv::uv() {}
|
uv::uv() {}
|
||||||
uv::uv(std::istream &stream_, uint32_t version = 68) {
|
uv::uv(std::istream &stream_, uint32_t version = 68) {
|
||||||
stream_.read((char *)&uv_scale, sizeof(float) * 4);
|
stream_.read((char *)&uv_scale, sizeof(float) * 4);
|
||||||
data = compressed<float>(stream_, true, true);
|
data = compressed<float>(stream_, true, true, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
c_vertex_table::c_vertex_table() {}
|
c_vertex_table::c_vertex_table() {}
|
||||||
c_vertex_table::c_vertex_table(std::istream &stream_, uint32_t size_, uint32_t version = 68) : size(size_) {
|
c_vertex_table::c_vertex_table(std::istream &stream_, uint32_t size_, uint32_t version = 68) : size(size_) {
|
||||||
uint32_t temp_count;
|
uint32_t temp_count;
|
||||||
|
|
||||||
point_flags = compressed<uint32_t>(stream_, true, true);
|
point_flags = compressed<uint32_t>(stream_, true, true, version);
|
||||||
|
|
||||||
uvsets.push_back(std::make_shared<uv>(stream_, version));
|
uvsets.push_back(std::make_shared<uv>(stream_, version));
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ namespace ace {
|
|||||||
uvsets.push_back(std::make_shared<uv>(stream_, version));
|
uvsets.push_back(std::make_shared<uv>(stream_, version));
|
||||||
}
|
}
|
||||||
|
|
||||||
points = compressed<ace::vector3<float>>(stream_, true, false, false);
|
points = compressed<ace::vector3<float>>(stream_, true, false, false, version);
|
||||||
|
|
||||||
size = points.size;
|
size = points.size;
|
||||||
}
|
}
|
||||||
@ -157,15 +157,15 @@ namespace ace {
|
|||||||
|
|
||||||
READ_STRING(name);
|
READ_STRING(name);
|
||||||
|
|
||||||
faces = compressed<uint16_t>(stream_, true, false);
|
faces = compressed<uint16_t>(stream_, true, false, version);
|
||||||
|
|
||||||
//face_weights = compressed<uint32_t>(stream_, true, false); // Face weights
|
//face_weights = compressed<uint32_t>(stream_, true, false, version); // Face weights
|
||||||
face_weights = compressed<uint32_t>(stream_, true, false);
|
face_weights = compressed<uint32_t>(stream_, true, false, version);
|
||||||
READ_BOOL(is_sectional);
|
READ_BOOL(is_sectional);
|
||||||
|
|
||||||
sections = compressed<uint32_t>(stream_, true, false);
|
sections = compressed<uint32_t>(stream_, true, false, version);
|
||||||
vertex_table = compressed<uint16_t>(stream_, true, false);
|
vertex_table = compressed<uint16_t>(stream_, true, false, version);
|
||||||
texture_weights = compressed<uint8_t>(stream_, true, false);
|
texture_weights = compressed<uint8_t>(stream_, true, false, version);
|
||||||
|
|
||||||
//stream_.read((char *)&junk, 4);
|
//stream_.read((char *)&junk, 4);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ namespace ace {
|
|||||||
raw_resolutions(nullptr), u_floats_1(nullptr), default_indicators(nullptr)
|
raw_resolutions(nullptr), u_floats_1(nullptr), default_indicators(nullptr)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
model_info::model_info(std::istream & stream_, const uint32_t lod_count)
|
model_info::model_info(std::istream & stream_, const uint32_t lod_count, uint32_t version)
|
||||||
: raw_resolutions(nullptr), u_floats_1(nullptr), default_indicators(nullptr) {
|
: raw_resolutions(nullptr), u_floats_1(nullptr), default_indicators(nullptr) {
|
||||||
|
|
||||||
raw_resolutions = new float[lod_count];
|
raw_resolutions = new float[lod_count];
|
||||||
@ -57,7 +57,7 @@ namespace ace {
|
|||||||
|
|
||||||
stream_.read((char *)&u_byte_1, sizeof(uint8_t));
|
stream_.read((char *)&u_byte_1, sizeof(uint8_t));
|
||||||
|
|
||||||
compressed<float> u_floats_1(stream_, true, false);
|
compressed<float> u_floats_1(stream_, true, false, version);
|
||||||
|
|
||||||
stream_.read((char *)&mass, sizeof(float));
|
stream_.read((char *)&mass, sizeof(float));
|
||||||
stream_.read((char *)&mass_reciprocal, sizeof(float));
|
stream_.read((char *)&mass_reciprocal, sizeof(float));
|
||||||
|
@ -11,7 +11,7 @@ namespace ace {
|
|||||||
class model_info {
|
class model_info {
|
||||||
public:
|
public:
|
||||||
model_info();
|
model_info();
|
||||||
model_info(std::istream &, const uint32_t lod_count);
|
model_info(std::istream &, const uint32_t lod_count, uint32_t version = 68);
|
||||||
~model_info();
|
~model_info();
|
||||||
|
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ animation_transform ace::simulation::animation::animate(const float phase, const
|
|||||||
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());
|
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());
|
||||||
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());
|
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());
|
||||||
|
|
||||||
if (true) {
|
if (this->type < 4) {
|
||||||
switch (this->type) {
|
switch (this->type) {
|
||||||
//rotation
|
//rotation
|
||||||
case 0: {
|
case 0: {
|
||||||
@ -242,7 +242,7 @@ animation_transform ace::simulation::animation::animate(const float phase, const
|
|||||||
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);
|
glm::vec3 rotation_axis = glm::vec3(1.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
animation_matrix = glm::rotate(glm::mat4(1.0f), scale, rotation_axis);
|
animation_matrix = glm::rotate(glm::mat4(1.0f), -scale, rotation_axis);
|
||||||
direction_matrix = glm::translate(glm::mat4(1.0f), axis_position);
|
direction_matrix = glm::translate(glm::mat4(1.0f), axis_position);
|
||||||
|
|
||||||
animation_matrix = animation_matrix * direction_matrix;
|
animation_matrix = animation_matrix * direction_matrix;
|
||||||
@ -268,8 +268,9 @@ animation_transform ace::simulation::animation::animate(const float phase, const
|
|||||||
scale = (scale / (max_value - min_value)) * (angle1 - angle0);
|
scale = (scale / (max_value - min_value)) * (angle1 - angle0);
|
||||||
glm::vec3 rotation_axis = glm::vec3(0.0f, 0.0f, 1.0f);
|
glm::vec3 rotation_axis = glm::vec3(0.0f, 0.0f, 1.0f);
|
||||||
|
|
||||||
animation_matrix = glm::rotate(glm::mat4(1.0f), scale, rotation_axis);
|
|
||||||
direction_matrix = glm::translate(glm::mat4(1.0f), axis_position);
|
direction_matrix = glm::translate(glm::mat4(1.0f), axis_position);
|
||||||
|
animation_matrix = glm::rotate(direction_matrix, -scale, rotation_axis);
|
||||||
|
|
||||||
|
|
||||||
animation_matrix = animation_matrix * direction_matrix;
|
animation_matrix = animation_matrix * direction_matrix;
|
||||||
|
|
||||||
@ -279,11 +280,16 @@ animation_transform ace::simulation::animation::animate(const float phase, const
|
|||||||
//translation
|
//translation
|
||||||
case 4: {
|
case 4: {
|
||||||
scale = (scale / (max_value - min_value)) * (offset1 - offset0);
|
scale = (scale / (max_value - min_value)) * (offset1 - offset0);
|
||||||
animation_matrix = glm::translate(glm::mat4(1.0f), glm::vec3(
|
glm::vec3 direction(
|
||||||
this->lod_info[lod_id]->axis_direction.x()*scale,
|
this->lod_info[lod_id]->axis_direction.x(),
|
||||||
this->lod_info[lod_id]->axis_direction.y()*scale,
|
this->lod_info[lod_id]->axis_direction.y(),
|
||||||
this->lod_info[lod_id]->axis_direction.z()*scale
|
this->lod_info[lod_id]->axis_direction.z()
|
||||||
));
|
);
|
||||||
|
direction = direction * scale;
|
||||||
|
direction_matrix = glm::translate(glm::mat4(1.0f), axis_position);
|
||||||
|
animation_matrix = glm::translate(glm::mat4(1.0f), direction);
|
||||||
|
animation_matrix = animation_matrix * direction_matrix;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//translationX
|
//translationX
|
||||||
@ -318,6 +324,7 @@ animation_transform ace::simulation::animation::animate(const float phase, const
|
|||||||
}
|
}
|
||||||
case 8: {
|
case 8: {
|
||||||
// fuck direct for now
|
// fuck direct for now
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
//hide
|
//hide
|
||||||
case 9: {
|
case 9: {
|
||||||
@ -342,11 +349,15 @@ float ace::simulation::animation::get_scale(float phase)
|
|||||||
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) * 2) + min_value;
|
||||||
|
// when over limit, mirror
|
||||||
|
if (phase > max_value) phase = max_value - (phase - max_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)) + 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;
|
||||||
|
5
extensions/tests/AT_01.txt
Normal file
5
extensions/tests/AT_01.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#c:\arma\arma3\addons\static_f_gamma.pbo C:\dev\ace3\extensions\tests\AT_01.txt
|
||||||
|
init:
|
||||||
|
debug_render:
|
||||||
|
register_vehicle:\A3\Static_F_gamma\AT_01\AT_01.p3d,0,4050.18;3802.55;5.075
|
||||||
|
fetch_result:1
|
@ -2,5 +2,5 @@
|
|||||||
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:0,Door_1_rot,0,Door_Locked_1_rot,0,Door_2_rot,0,Door_Locked_2_rot,0,
|
set_animation_state:0,Door_1_rot,1,Door_Locked_1_rot,0,Door_2_rot,0,Door_Locked_2_rot,0,
|
||||||
fetch_result:1
|
fetch_result:1
|
@ -1,61 +0,0 @@
|
|||||||
//config.cpp
|
|
||||||
|
|
||||||
class CfgPatches
|
|
||||||
{
|
|
||||||
class nou_sys_snow
|
|
||||||
{
|
|
||||||
units[] = {};
|
|
||||||
weapons[] = {};
|
|
||||||
requiredVersion = 0.1;
|
|
||||||
requiredAddons[] = {"A3_Data_F"};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
class CfgVehicles {
|
|
||||||
class House;
|
|
||||||
class nou_test_model: House
|
|
||||||
{
|
|
||||||
author = "Nou";
|
|
||||||
_generalMacro = "nou_snow_2x2";
|
|
||||||
scope = 2;
|
|
||||||
model = "test_model\test.p3d";
|
|
||||||
vehicleClass = "Structures";
|
|
||||||
cost = 50000;
|
|
||||||
replaceDamagedLimit = 0.99999;
|
|
||||||
class AnimationSources {
|
|
||||||
class box1
|
|
||||||
{
|
|
||||||
source = "user";
|
|
||||||
animPeriod = 0.0001;
|
|
||||||
initPhase = 0;
|
|
||||||
minValue = 0;
|
|
||||||
maxValue = 3;
|
|
||||||
};
|
|
||||||
class box2
|
|
||||||
{
|
|
||||||
source = "user";
|
|
||||||
animPeriod = 0.0001;
|
|
||||||
initPhase = 0;
|
|
||||||
minValue = -1;
|
|
||||||
maxValue = 1;
|
|
||||||
};
|
|
||||||
class box3_translate
|
|
||||||
{
|
|
||||||
source = "user";
|
|
||||||
animPeriod = 0.0001;
|
|
||||||
initPhase = 0;
|
|
||||||
minValue = -10;
|
|
||||||
maxValue = 10;
|
|
||||||
};
|
|
||||||
class box3_rotate
|
|
||||||
{
|
|
||||||
source = "user";
|
|
||||||
animPeriod = 0.0001;
|
|
||||||
initPhase = 0;
|
|
||||||
minValue = 0;
|
|
||||||
maxValue = 1;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
@ -1,113 +0,0 @@
|
|||||||
//model.cfg
|
|
||||||
|
|
||||||
class CfgSkeletons
|
|
||||||
{
|
|
||||||
class Default
|
|
||||||
{
|
|
||||||
isDiscrete = 1;
|
|
||||||
skeletonInherit = "";
|
|
||||||
skeletonBones[] = {};
|
|
||||||
};
|
|
||||||
|
|
||||||
class test_skeleton : Default {
|
|
||||||
skeletonBones[] =
|
|
||||||
{
|
|
||||||
"box1","",
|
|
||||||
"box2","box1",
|
|
||||||
"box3","box2"
|
|
||||||
};
|
|
||||||
pivotsModel = "";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
class CfgModels
|
|
||||||
{
|
|
||||||
class Default
|
|
||||||
{
|
|
||||||
sectionsInherit = "";
|
|
||||||
sections[] = {};
|
|
||||||
};
|
|
||||||
|
|
||||||
class test : Default {
|
|
||||||
sectionsInherit = "";
|
|
||||||
sections[] =
|
|
||||||
{
|
|
||||||
};
|
|
||||||
skeletonName = "test_skeleton";
|
|
||||||
|
|
||||||
class Animations
|
|
||||||
{
|
|
||||||
class box1
|
|
||||||
{
|
|
||||||
type = "rotationY";
|
|
||||||
axis = "box2_translate_axis";
|
|
||||||
source = "box1";
|
|
||||||
selection = "box1";
|
|
||||||
animPeriod = 0.0001;
|
|
||||||
minValue = 0;
|
|
||||||
maxValue = 3;
|
|
||||||
offset0 = 0;
|
|
||||||
offset1 = 1;
|
|
||||||
angle0 = 0;
|
|
||||||
angle1 = "rad 360";
|
|
||||||
sourceAddress = "loop";
|
|
||||||
};
|
|
||||||
|
|
||||||
class box2 {
|
|
||||||
type = "translationZ";
|
|
||||||
source = "box2";
|
|
||||||
selection = "box2";
|
|
||||||
animPeriod = 0.0001;
|
|
||||||
minValue = -1;
|
|
||||||
maxValue = 1;
|
|
||||||
sourceAddress = "loop";
|
|
||||||
};
|
|
||||||
class box3_rotate
|
|
||||||
{
|
|
||||||
type = "direct";
|
|
||||||
source = "box3_rotate";
|
|
||||||
selection = "box3";
|
|
||||||
animPeriod = 0.0001;
|
|
||||||
axisPos[] = {1,2,3};
|
|
||||||
axisDir[] = {4,5,6};
|
|
||||||
angle = "401.070457";
|
|
||||||
axisOffset = 8;
|
|
||||||
sourceAddress = "loop";
|
|
||||||
minValue = 0;
|
|
||||||
maxValue = 10;
|
|
||||||
};
|
|
||||||
class box3_translate
|
|
||||||
{
|
|
||||||
type = "translation";
|
|
||||||
source = "box3_translate";
|
|
||||||
selection = "box3";
|
|
||||||
axis = "box2_translate_axis";
|
|
||||||
offset0 = 1;
|
|
||||||
offset1 = -1;
|
|
||||||
animPeriod = 0.0001;
|
|
||||||
minValue = -10;
|
|
||||||
maxValue = 10;
|
|
||||||
sourceAddress = "clamp";
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
class box3_rotate
|
|
||||||
{
|
|
||||||
type = "direct";
|
|
||||||
source = "box3_rotate";
|
|
||||||
selection = "box3";
|
|
||||||
animPeriod = 0.0001;
|
|
||||||
axisPos[] = {0,0,0};
|
|
||||||
axisDir[] = {0,1,0};
|
|
||||||
angle = "1080";
|
|
||||||
axisOffset = 1;
|
|
||||||
sourceAddress = "loop";
|
|
||||||
minValue = 0;
|
|
||||||
maxValue = 10;
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user