mirror of
https://github.com/Theaninova/mhlib.git
synced 2025-12-12 12:36:17 +00:00
implement envelope
This commit is contained in:
@@ -27,7 +27,7 @@ Progress: About 90% ([LWO2 Spec](http://static.lightwave3d.com/sdk/2015/html/fil
|
|||||||
| Discontinuous Vertex Mapping | `VMAD` | ✅ |
|
| Discontinuous Vertex Mapping | `VMAD` | ✅ |
|
||||||
| Vertex Map Parameter | `VMPA` | ✅ |
|
| Vertex Map Parameter | `VMPA` | ✅ |
|
||||||
| [Envelope Definition](#envelope-subchunks) | `ENVL` | ✅ |
|
| [Envelope Definition](#envelope-subchunks) | `ENVL` | ✅ |
|
||||||
| [Image (-Sequence)](#clip-subchunks) | `CLIP` | 🚧 |
|
| [Image (-Sequence)](#clip-subchunks) | `CLIP` | ✅ |
|
||||||
| [Surface Definition](#surface-subchunks) | `SURF` | 🚧 |
|
| [Surface Definition](#surface-subchunks) | `SURF` | 🚧 |
|
||||||
| Bounding Box | `BBOX` | ✅ |
|
| Bounding Box | `BBOX` | ✅ |
|
||||||
| Description Line | `DESC` | ✅ |
|
| Description Line | `DESC` | ✅ |
|
||||||
@@ -54,7 +54,7 @@ Progress: About 90% ([LWO2 Spec](http://static.lightwave3d.com/sdk/2015/html/fil
|
|||||||
|----------------------|--------|--------|
|
|----------------------|--------|--------|
|
||||||
| Still Image | `STIL` | ✅ |
|
| Still Image | `STIL` | ✅ |
|
||||||
| Image Sequence | `ISEQ` | ✅ |
|
| Image Sequence | `ISEQ` | ✅ |
|
||||||
| Plugin Animation | `ANIM` | ❌ |
|
| Plugin Animation | `ANIM` | ✅ |
|
||||||
| Reference (Clone) | `XREF` | ✅ |
|
| Reference (Clone) | `XREF` | ✅ |
|
||||||
| Flag (Undocumented) | `FLAG` | ⚠️ |
|
| Flag (Undocumented) | `FLAG` | ⚠️ |
|
||||||
| Color-cycling Still | `STCC` | ✅ |
|
| Color-cycling Still | `STCC` | ✅ |
|
||||||
@@ -68,9 +68,9 @@ Progress: About 90% ([LWO2 Spec](http://static.lightwave3d.com/sdk/2015/html/fil
|
|||||||
| Saturation | `SATR` | ✅ |
|
| Saturation | `SATR` | ✅ |
|
||||||
| Hue | `HUE` | ✅ |
|
| Hue | `HUE` | ✅ |
|
||||||
| Gamma Correction | `GAMM` | ✅ |
|
| Gamma Correction | `GAMM` | ✅ |
|
||||||
| Negative | `NEGA` | ❌ |
|
| Negative | `NEGA` | ✅ |
|
||||||
| Plugin Image Filters | `IFLT` | ❌ |
|
| Plugin Image Filters | `IFLT` | ✅ |
|
||||||
| Plugin Pixel Filters | `PFLT` | ❌ |
|
| Plugin Pixel Filters | `PFLT` | ✅ |
|
||||||
|
|
||||||
|
|
||||||
### Surface Subchunks
|
### Surface Subchunks
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ use binrw::binread;
|
|||||||
|
|
||||||
pub mod blocks;
|
pub mod blocks;
|
||||||
pub mod surface_parameters;
|
pub mod surface_parameters;
|
||||||
|
pub mod plugin;
|
||||||
|
|
||||||
#[binread]
|
#[binread]
|
||||||
#[br(import(_length: u32))]
|
#[br(import(_length: u32))]
|
||||||
|
|||||||
16
rust/lightwave/src/lwo2/sub_tags/plugin.rs
Normal file
16
rust/lightwave/src/lwo2/sub_tags/plugin.rs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
use binrw::{binread, NullString, PosValue};
|
||||||
|
|
||||||
|
#[binread]
|
||||||
|
#[br(import(length: u32))]
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct PluginServerNameAndData {
|
||||||
|
#[br(temp)]
|
||||||
|
start_pos: PosValue<()>,
|
||||||
|
#[br(align_after = 2)]
|
||||||
|
pub server_name: NullString,
|
||||||
|
pub flags: u16,
|
||||||
|
#[br(temp)]
|
||||||
|
end_pos: PosValue<()>,
|
||||||
|
#[br(count = length as u64 - (end_pos.pos - start_pos.pos))]
|
||||||
|
pub parameters: Vec<u8>,
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ use crate::binrw_helpers::until_size_limit;
|
|||||||
use crate::iff::SubChunk;
|
use crate::iff::SubChunk;
|
||||||
use crate::lwo2::vx;
|
use crate::lwo2::vx;
|
||||||
use binrw::{binread, NullString, PosValue};
|
use binrw::{binread, NullString, PosValue};
|
||||||
|
use crate::lwo2::sub_tags::plugin::PluginServerNameAndData;
|
||||||
|
|
||||||
#[binread]
|
#[binread]
|
||||||
#[br(import(length: u32))]
|
#[br(import(length: u32))]
|
||||||
@@ -31,7 +32,7 @@ pub enum EnvelopeSubChunk {
|
|||||||
#[br(magic(b"SPAN"))]
|
#[br(magic(b"SPAN"))]
|
||||||
IntervalInterpolation(SubChunk<IntervalInterpolation>),
|
IntervalInterpolation(SubChunk<IntervalInterpolation>),
|
||||||
#[br(magic(b"CHAN"))]
|
#[br(magic(b"CHAN"))]
|
||||||
PluginChannelModifiers(SubChunk<PluginChannelModifiers>),
|
PluginChannelModifiers(SubChunk<PluginServerNameAndData>),
|
||||||
#[br(magic(b"NAME"))]
|
#[br(magic(b"NAME"))]
|
||||||
ChannelName(SubChunk<PluginChannelName>),
|
ChannelName(SubChunk<PluginChannelName>),
|
||||||
}
|
}
|
||||||
@@ -46,24 +47,6 @@ pub struct PluginChannelName {
|
|||||||
pub channel_name: NullString,
|
pub channel_name: NullString,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Channel modifiers can be associated with an envelope. Each channel chunk contains the name of
|
|
||||||
/// the plug-in and some flag bits. Only the first flag bit is defined; if set, the plug-in is
|
|
||||||
/// disabled. The data that follows this, if any, is owned by the plug-in.
|
|
||||||
#[binread]
|
|
||||||
#[br(import(length: u32))]
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct PluginChannelModifiers {
|
|
||||||
#[br(temp)]
|
|
||||||
start_pos: PosValue<()>,
|
|
||||||
#[br(align_after = 2)]
|
|
||||||
pub server_name: NullString,
|
|
||||||
pub flags: u16,
|
|
||||||
#[br(temp)]
|
|
||||||
end_pos: PosValue<()>,
|
|
||||||
#[br(count = length as u64 - (end_pos.pos - start_pos.pos))]
|
|
||||||
pub parameters: Vec<u8>,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Defines the interpolation between the most recent KEY chunk and the KEY immediately before it in
|
/// Defines the interpolation between the most recent KEY chunk and the KEY immediately before it in
|
||||||
/// time. The type identifies the interpolation algorithm and can be STEP, LINE, TCB
|
/// time. The type identifies the interpolation algorithm and can be STEP, LINE, TCB
|
||||||
/// (Kochanek-Bartels), HERM (Hermite), BEZI (1D Bezier) or BEZ2 (2D Bezier).
|
/// (Kochanek-Bartels), HERM (Hermite), BEZI (1D Bezier) or BEZ2 (2D Bezier).
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
use crate::binrw_helpers::until_size_limit;
|
use crate::binrw_helpers::until_size_limit;
|
||||||
use crate::iff::SubChunk;
|
use crate::iff::SubChunk;
|
||||||
use crate::lwo2::sub_tags::ValueEnvelope;
|
use crate::lwo2::sub_tags::plugin::PluginServerNameAndData;
|
||||||
use binrw::{binread, NullString};
|
use crate::lwo2::sub_tags::{EnableState, ValueEnvelope};
|
||||||
|
use binrw::{binread, NullString, PosValue};
|
||||||
|
|
||||||
/// Describes an image or a sequence of images. Surface definitions specify images by referring to
|
/// Describes an image or a sequence of images. Surface definitions specify images by referring to
|
||||||
/// CLIP chunks. The term "clip" is used to describe these because they can be numbered sequences
|
/// CLIP chunks. The term "clip" is used to describe these because they can be numbered sequences
|
||||||
@@ -24,6 +25,8 @@ pub enum ImageClipSubChunk {
|
|||||||
StillImage(SubChunk<StillImage>),
|
StillImage(SubChunk<StillImage>),
|
||||||
#[br(magic(b"ISEQ"))]
|
#[br(magic(b"ISEQ"))]
|
||||||
ImageSequence(SubChunk<ImageSequence>),
|
ImageSequence(SubChunk<ImageSequence>),
|
||||||
|
#[br(magic(b"ANIM"))]
|
||||||
|
PluginAnimation(SubChunk<PluginAnimation>),
|
||||||
#[br(magic(b"XREF"))]
|
#[br(magic(b"XREF"))]
|
||||||
Reference(SubChunk<Reference>),
|
Reference(SubChunk<Reference>),
|
||||||
#[br(magic(b"FLAG"))]
|
#[br(magic(b"FLAG"))]
|
||||||
@@ -46,10 +49,33 @@ pub enum ImageClipSubChunk {
|
|||||||
Brightness(SubChunk<ValueEnvelope>),
|
Brightness(SubChunk<ValueEnvelope>),
|
||||||
#[br(magic(b"SATR"))]
|
#[br(magic(b"SATR"))]
|
||||||
Saturation(SubChunk<ValueEnvelope>),
|
Saturation(SubChunk<ValueEnvelope>),
|
||||||
#[br(magic(b"HUE"))] // TODO: Typo? Docs say it's just "HUE"
|
#[br(magic(b"HUE\0"))]
|
||||||
Hue(SubChunk<ValueEnvelope>),
|
Hue(SubChunk<ValueEnvelope>),
|
||||||
#[br(magic(b"GAMM"))]
|
#[br(magic(b"GAMM"))]
|
||||||
GammaCorrection(SubChunk<ValueEnvelope>),
|
GammaCorrection(SubChunk<ValueEnvelope>),
|
||||||
|
#[br(magic(b"NEGA"))]
|
||||||
|
Negative(SubChunk<EnableState>),
|
||||||
|
#[br(magic(b"IFLT"))]
|
||||||
|
PluginImageFilters(SubChunk<PluginServerNameAndData>),
|
||||||
|
#[br(magic(b"PFLT"))]
|
||||||
|
PluginPixelFilters(SubChunk<PluginServerNameAndData>),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[binread]
|
||||||
|
#[br(import(_length: u32))]
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct PluginAnimation {
|
||||||
|
#[br(temp)]
|
||||||
|
start_pos: PosValue<()>,
|
||||||
|
#[br(align_after = 2)]
|
||||||
|
pub file_name: NullString,
|
||||||
|
#[br(align_after = 2)]
|
||||||
|
pub server_name: NullString,
|
||||||
|
pub flags: u16,
|
||||||
|
#[br(temp)]
|
||||||
|
end_pos: PosValue<()>,
|
||||||
|
#[br(count = end_pos.pos - start_pos.pos)]
|
||||||
|
pub data: Vec<u8>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Contains the color space of the texture. If the flag is 0, then the color space is contained
|
/// Contains the color space of the texture. If the flag is 0, then the color space is contained
|
||||||
|
|||||||
Reference in New Issue
Block a user