Skip to content

Commit

Permalink
small fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
tychedelia committed Nov 7, 2023
1 parent 4d9a77c commit b0e35da
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
8 changes: 4 additions & 4 deletions td-rs-derive-py/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub fn params_derive(input: TokenStream) -> TokenStream {
struct PyOpArgs {
get: bool,
set: bool,
force_cook: bool,
auto_cook: bool,
doc: Option<syn::LitStr>,
}

Expand All @@ -23,7 +23,7 @@ impl Default for PyOpArgs {
Self {
get: true,
set: true,
force_cook: false,
auto_cook: false,
doc: None,
}
}
Expand Down Expand Up @@ -74,7 +74,7 @@ fn parse_attribute_args(args: syn::AttributeArgs) -> Result<PyOpArgs, syn::Error
Ok(PyOpArgs {
get,
set,
force_cook: auto_cook,
auto_cook,
doc,
})
}
Expand Down Expand Up @@ -107,7 +107,7 @@ fn impl_py_op(input: &DeriveInput) -> TokenStream {
let field_type = &field.ty;
let getter_name = format_ident!("get_{}", field_name);
let setter_name = format_ident!("set_{}", field_name);
let auto_cook = args.force_cook;
let auto_cook = args.auto_cook;

let get_fn = if args.get {
Some(quote! {
Expand Down
25 changes: 23 additions & 2 deletions td-rs-sop/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,12 +313,12 @@ pub struct ColorEnabled;
pub struct NormalEnabled;
pub struct TexCoordEnabled;

pub struct Alloc<ColorEnabled, NormalEnabled, TexCoordEnabled> {
pub struct Alloc<NormalEnabled, ColorEnabled, TexCoordEnabled> {
pub vertices: usize,
pub indices: usize,
pub buffer_mode: BufferMode,
_color: std::marker::PhantomData<ColorEnabled>,
_normal: std::marker::PhantomData<NormalEnabled>,
_color: std::marker::PhantomData<ColorEnabled>,
_tex_coords: std::marker::PhantomData<TexCoordEnabled>,
}

Expand Down Expand Up @@ -394,6 +394,27 @@ impl<'execute> SopVboOutput<'execute, Unalloc> {
.allocVBO(vertices as i32, indices as i32, buffer_mode.into());
}

pub fn alloc_none(
mut self,
vertices: usize,
indices: usize,
tex_coords: usize,
buffor_mode: BufferMode,
) -> SopVboOutput<'execute, Alloc<(), (), ()>> {
self.alloc_inner(vertices, indices, false, false, 0, buffor_mode);
SopVboOutput {
state: Alloc {
vertices,
indices,
buffer_mode,
_color: Default::default(),
_normal: Default::default(),
_tex_coords: Default::default(),
},
output: self.output,
}
}

pub fn alloc_all(
mut self,
vertices: usize,
Expand Down

0 comments on commit b0e35da

Please sign in to comment.