Skip to content

Commit

Permalink
rename to primary_source
Browse files Browse the repository at this point in the history
  • Loading branch information
marstaik committed Jun 19, 2024
1 parent fca3dda commit 5465423
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions gltf-json/src/texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ pub struct Texture {

/// The index of the image used by this texture.
#[serde(default = "source_default", skip_serializing_if = "source_is_empty")]
source: Index<image::Image>,
pub source: Index<image::Image>,

/// Extension specific data.
#[serde(default, skip_serializing_if = "Option::is_none")]
Expand All @@ -220,7 +220,7 @@ pub struct Texture {

impl Texture {
/// The index of the image used by this texture.
pub fn source(&self) -> Index<image::Image> {
pub fn primary_source(&self) -> Index<image::Image> {
#[allow(unused_mut)]
let mut source = self.source;
#[cfg(feature = "EXT_texture_webp")]
Expand Down Expand Up @@ -250,7 +250,7 @@ impl Validate for Texture {
self.extensions
.validate(root, || path().field("extensions"), report);

source_validate(&self.source(), root, || path().field("source"), report);
source_validate(&self.primary_source(), root, || path().field("source"), report);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ impl<'a> Texture<'a> {
/// Returns the image used by this texture.
#[cfg(feature = "allow_empty_texture")]
pub fn source(&self) -> Option<image::Image<'a>> {
let index = self.json.source().value();
let index = self.json.primary_source().value();
if index == u32::MAX as usize {
None
} else {
Expand All @@ -173,7 +173,7 @@ impl<'a> Texture<'a> {
pub fn source(&self) -> image::Image<'a> {
self.document
.images()
.nth(self.json.source().value())
.nth(self.json.primary_source().value())
.unwrap()
}

Expand Down

0 comments on commit 5465423

Please sign in to comment.