molgfx_render/engine/chunk_placement/
instances.rs1use super::ChunkPlacementId;
2use molgfx_core::{AnalyticTemplate, ResidencyTicket};
3use molgfx_math::Rgba8;
4use std::sync::Arc;
5
6#[derive(Clone, Debug)]
8pub struct InstanceChunkPlacement {
9 id: ChunkPlacementId,
10 ticket: ResidencyTicket,
11 template: Arc<AnalyticTemplate>,
12 color: Rgba8,
13}
14
15impl PartialEq for InstanceChunkPlacement {
16 fn eq(&self, other: &Self) -> bool {
17 self.id == other.id
18 && self.ticket == other.ticket
19 && Arc::ptr_eq(&self.template, &other.template)
20 && self.color == other.color
21 }
22}
23
24impl InstanceChunkPlacement {
25 #[must_use]
27 pub fn new(
28 id: ChunkPlacementId,
29 ticket: ResidencyTicket,
30 template: Arc<AnalyticTemplate>,
31 color: Rgba8,
32 ) -> Self {
33 Self {
34 id,
35 ticket,
36 template,
37 color,
38 }
39 }
40
41 #[must_use]
43 pub const fn id(&self) -> ChunkPlacementId {
44 self.id
45 }
46
47 #[must_use]
49 pub const fn ticket(&self) -> ResidencyTicket {
50 self.ticket
51 }
52
53 #[must_use]
55 pub const fn template(&self) -> &Arc<AnalyticTemplate> {
56 &self.template
57 }
58
59 #[must_use]
61 pub const fn color(&self) -> Rgba8 {
62 self.color
63 }
64}