File include/jrf/scene.h changed (mode: 100644) (index de9fc6c..208616c) |
... |
... |
struct jrf::SceneEntry |
12 |
12 |
pos = {}; |
pos = {}; |
13 |
13 |
shift = {}; |
shift = {}; |
14 |
14 |
transform = {}; |
transform = {}; |
15 |
|
transform[0] = transform[4] = transform[8] = 1; |
|
|
15 |
|
transform[0] = transform[5] = transform[10] = transform[15] = 1; |
16 |
16 |
} |
} |
17 |
17 |
|
|
18 |
18 |
jl::array<float, 3> pos; ///< position |
jl::array<float, 3> pos; ///< position |
19 |
19 |
jl::array<int32_t,3> shift; ///< shift of position |
jl::array<int32_t,3> shift; ///< shift of position |
20 |
|
jl::array<float, 9> transform; ///< transformation matrix 3x3 |
|
|
20 |
|
jl::array<float, 16> transform; ///< transformation matrix 4x4 |
21 |
21 |
}; |
}; |
22 |
22 |
|
|
23 |
23 |
void destroy() { model_path.destroy(); } |
void destroy() { model_path.destroy(); } |
|
... |
... |
struct jrf::SceneEntry |
32 |
32 |
if (res != Result::SUCCESS) |
if (res != Result::SUCCESS) |
33 |
33 |
return res; |
return res; |
34 |
34 |
|
|
35 |
|
jl::io_agent_alt<IO> *p_io = p_mediator; |
|
|
35 |
|
auto *p_io = jl::io_agent_p_alt_cast(p_mediator); |
36 |
36 |
if (not p_io->read_items(&options.pos)) |
if (not p_io->read_items(&options.pos)) |
37 |
37 |
goto CANCEL; |
goto CANCEL; |
38 |
38 |
if (not p_io->read_items(&options.shift)) |
if (not p_io->read_items(&options.shift)) |
|
... |
... |
struct jrf::Scene |
81 |
81 |
template<typename IO = jl::io_agent> |
template<typename IO = jl::io_agent> |
82 |
82 |
[[nodiscard]] Result read(IO *p_mediator) |
[[nodiscard]] Result read(IO *p_mediator) |
83 |
83 |
{ |
{ |
84 |
|
jl::io_agent_alt<IO> *p_io = p_mediator; |
|
|
84 |
|
auto *p_io = jl::io_agent_p_alt_cast(p_mediator); |
85 |
85 |
if (not p_io->read_items(&options.shift)) |
if (not p_io->read_items(&options.shift)) |
86 |
86 |
return Result::MEDIATOR_ERROR; |
return Result::MEDIATOR_ERROR; |
87 |
87 |
if (not p_io->read_items(&options.shift_scale)) |
if (not p_io->read_items(&options.shift_scale)) |
|
... |
... |
struct jrf::Scene |
98 |
98 |
if (not entries.init(entry_count)) |
if (not entries.init(entry_count)) |
99 |
99 |
return Result::ALLOCATION_FAIL; |
return Result::ALLOCATION_FAIL; |
100 |
100 |
|
|
101 |
|
Result res; |
|
102 |
|
for (uint64_t i = 0; i < entry_count; ++i) { |
|
103 |
|
res = entries[i].read(p_mediator); |
|
|
101 |
|
for (uint64_t i = 0; i < entry_count; ++i) |
|
102 |
|
{ |
|
103 |
|
Result res = entries[i].read(p_mediator); |
104 |
104 |
if (res != Result::SUCCESS) |
if (res != Result::SUCCESS) |
105 |
105 |
{ |
{ |
106 |
106 |
while(i > 0) |
while(i > 0) |
|
... |
... |
struct jrf::Scene |
109 |
109 |
break; |
break; |
110 |
110 |
} |
} |
111 |
111 |
} |
} |
112 |
|
return res; |
|
|
112 |
|
return Result::SUCCESS; |
113 |
113 |
} |
} |
114 |
114 |
|
|
115 |
115 |
template<typename IO = jl::io_agent> |
template<typename IO = jl::io_agent> |