File tree Expand file tree Collapse file tree 2 files changed +55
-2
lines changed
bones_framework/src/render Expand file tree Collapse file tree 2 files changed +55
-2
lines changed Original file line number Diff line number Diff line change @@ -157,6 +157,26 @@ pub fn sync_cameras(
157157 } ,
158158 OrthographicProjection {
159159 scaling_mode : match bones_camera. size {
160+ bones:: CameraSize :: Fixed { width, height } => {
161+ ScalingMode :: Fixed { width, height }
162+ }
163+ bones:: CameraSize :: Max {
164+ max_width,
165+ max_height,
166+ } => ScalingMode :: AutoMax {
167+ max_width,
168+ max_height,
169+ } ,
170+ bones:: CameraSize :: Min {
171+ min_width,
172+ min_height,
173+ } => ScalingMode :: AutoMin {
174+ min_width,
175+ min_height,
176+ } ,
177+ bones:: CameraSize :: Window { pixels_per_unit } => {
178+ ScalingMode :: WindowSize ( pixels_per_unit)
179+ }
160180 bones:: CameraSize :: FixedHeight ( h) => ScalingMode :: FixedVertical ( h) ,
161181 bones:: CameraSize :: FixedWidth ( w) => ScalingMode :: FixedHorizontal ( w) ,
162182 } ,
Original file line number Diff line number Diff line change @@ -33,10 +33,43 @@ pub struct Camera {
3333#[ derive( HasSchema , Debug , Clone , Copy ) ]
3434#[ repr( C , u8 ) ]
3535pub enum CameraSize {
36- /// The camera will be a fixed height with a width dependent on the aspect ratio.
36+ /// The camera will capture exactly the `width` and `height` in world units,
37+ /// stretching with the viewport.
38+ Fixed {
39+ /// The camera will capture exactly this width in world units.
40+ width : f32 ,
41+ /// The camera will capture exactly this height in world units.
42+ height : f32 ,
43+ } ,
44+ /// The camera will be a fixed height with a width dependent on the aspect
45+ /// ratio.
3746 FixedHeight ( f32 ) ,
38- /// The camera will be a fixed width with a height dependent on the aspect ratio.
47+ /// The camera will be a fixed width with a height dependent on the aspect
48+ /// ratio.
3949 FixedWidth ( f32 ) ,
50+ /// The viewport will determine the camera size with the camera capturing
51+ /// one world unit per the specified amount of viewport pixels.
52+ Window {
53+ /// The amount of viewport pixels that will cover one world unit. The
54+ /// camera will capture one world unit per this amount of pixels.
55+ pixels_per_unit : f32 ,
56+ } ,
57+ /// The camera will capture at least the specified height and width in world
58+ /// units.
59+ Min {
60+ /// The camera will capture at least this many world units wide.
61+ min_width : f32 ,
62+ /// The camera will capture at least this many world units high.
63+ min_height : f32 ,
64+ } ,
65+ /// The camera will capture at most the specified height and width in world
66+ /// units.
67+ Max {
68+ /// The camera will capture at most this many world units wide.
69+ max_width : f32 ,
70+ /// The camera will capture at most this many world units high.
71+ max_height : f32 ,
72+ } ,
4073}
4174
4275impl Default for CameraSize {
You can’t perform that action at this time.
0 commit comments