Prevent cycles with ARC by adding {.cursor.}
to all "back" references.
TODO: Use destructors to set all cursors of children objects to `nil`.
This commit is contained in:
parent
1557d59d0f
commit
3ff1d663a2
|
@ -98,7 +98,7 @@ type
|
||||||
GameObject* = ref object of RootObj
|
GameObject* = ref object of RootObj
|
||||||
# TODO: remove otype
|
# TODO: remove otype
|
||||||
otype*: ObjectType ## private
|
otype*: ObjectType ## private
|
||||||
engine*: MyouEngine ## private
|
engine* {.cursor.}: MyouEngine ## private
|
||||||
debug*: bool ## private
|
debug*: bool ## private
|
||||||
position*: Vec3
|
position*: Vec3
|
||||||
rotation*: Quat
|
rotation*: Quat
|
||||||
|
@ -110,12 +110,12 @@ type
|
||||||
object_color*: Vec4
|
object_color*: Vec4
|
||||||
# alpha*: float
|
# alpha*: float
|
||||||
matrix_parent_inverse*: Mat4
|
matrix_parent_inverse*: Mat4
|
||||||
scene*: Scene
|
scene* {.cursor.}: Scene
|
||||||
source_scene_name*: string
|
source_scene_name*: string
|
||||||
# data_dir*: string
|
# data_dir*: string
|
||||||
# dupli_group*: unknown
|
# dupli_group*: unknown
|
||||||
visible*: bool
|
visible*: bool
|
||||||
parent*: GameObject
|
parent* {.cursor.}: GameObject
|
||||||
children*: seq[GameObject]
|
children*: seq[GameObject]
|
||||||
auto_update_matrix*: bool
|
auto_update_matrix*: bool
|
||||||
world_matrix*: Mat4
|
world_matrix*: Mat4
|
||||||
|
@ -158,7 +158,8 @@ type
|
||||||
|
|
||||||
# most fields should be private
|
# most fields should be private
|
||||||
MeshData* = ref object
|
MeshData* = ref object
|
||||||
engine*: MyouEngine
|
engine* {.cursor.}: MyouEngine
|
||||||
|
# TODO: seq of {.cursor.}s?
|
||||||
users*: seq[GameObject] ## private
|
users*: seq[GameObject] ## private
|
||||||
hash*: string
|
hash*: string
|
||||||
varrays*: seq[ArrRef[float32]]
|
varrays*: seq[ArrRef[float32]]
|
||||||
|
@ -287,8 +288,8 @@ type
|
||||||
# shadows
|
# shadows
|
||||||
|
|
||||||
ShadowManager* = ref object of RootObj
|
ShadowManager* = ref object of RootObj
|
||||||
engine*: MyouEngine
|
engine* {.cursor.}: MyouEngine
|
||||||
light*: Light
|
light* {.cursor.}: Light
|
||||||
framebuffer*: Framebuffer
|
framebuffer*: Framebuffer
|
||||||
texture*: Texture
|
texture*: Texture
|
||||||
sampler_type*: string
|
sampler_type*: string
|
||||||
|
@ -330,7 +331,7 @@ type
|
||||||
padding3: float32
|
padding3: float32
|
||||||
|
|
||||||
Scene* = ref object
|
Scene* = ref object
|
||||||
engine*: MyouEngine
|
engine* {.cursor.}: MyouEngine
|
||||||
name*: string
|
name*: string
|
||||||
enabled*: bool
|
enabled*: bool
|
||||||
children*: seq[GameObject]
|
children*: seq[GameObject]
|
||||||
|
@ -406,7 +407,7 @@ type
|
||||||
viewport_size*, viewport_size_inv*: Vec2
|
viewport_size*, viewport_size_inv*: Vec2
|
||||||
|
|
||||||
RenderManager* = ref object
|
RenderManager* = ref object
|
||||||
engine*: MyouEngine
|
engine* {.cursor.}: MyouEngine
|
||||||
initialized*: bool
|
initialized*: bool
|
||||||
# temporary_framebuffers*: Table[int, ByteFramebuffer]
|
# temporary_framebuffers*: Table[int, ByteFramebuffer]
|
||||||
render_tick*: int
|
render_tick*: int
|
||||||
|
@ -492,7 +493,7 @@ type
|
||||||
# ubo.nim
|
# ubo.nim
|
||||||
|
|
||||||
UBO* = ref object
|
UBO* = ref object
|
||||||
renderer*: RenderManager
|
renderer* {.cursor.}: RenderManager
|
||||||
name*: string
|
name*: string
|
||||||
size32*: int
|
size32*: int
|
||||||
byte_storage*: ArrRef[byte]
|
byte_storage*: ArrRef[byte]
|
||||||
|
@ -529,7 +530,7 @@ type
|
||||||
EsPrecisionHigh
|
EsPrecisionHigh
|
||||||
|
|
||||||
Material* = ref object
|
Material* = ref object
|
||||||
engine*: MyouEngine
|
engine* {.cursor.}: MyouEngine
|
||||||
name*: string
|
name*: string
|
||||||
textures*: OrderedTable[string, Texture]
|
textures*: OrderedTable[string, Texture]
|
||||||
ubos*: seq[UBO]
|
ubos*: seq[UBO]
|
||||||
|
@ -560,7 +561,7 @@ type
|
||||||
|
|
||||||
# TODO: choose better names
|
# TODO: choose better names
|
||||||
Shader* = ref object
|
Shader* = ref object
|
||||||
engine*: MyouEngine # do we need this?
|
engine* {.cursor.}: MyouEngine # do we need this?
|
||||||
id*: int
|
id*: int
|
||||||
program*: GLuint
|
program*: GLuint
|
||||||
material*: Material # do we need this?
|
material*: Material # do we need this?
|
||||||
|
@ -639,7 +640,7 @@ type
|
||||||
tile_size*: Vec2
|
tile_size*: Vec2
|
||||||
|
|
||||||
Texture* = ref object of RootObj
|
Texture* = ref object of RootObj
|
||||||
engine*: MyouEngine
|
engine* {.cursor.}: MyouEngine
|
||||||
name*: string
|
name*: string
|
||||||
storage*: TextureStorage ## private
|
storage*: TextureStorage ## private
|
||||||
loaded*: bool
|
loaded*: bool
|
||||||
|
@ -660,7 +661,7 @@ type
|
||||||
DepthTexture
|
DepthTexture
|
||||||
|
|
||||||
Framebuffer* = ref object of RootObj
|
Framebuffer* = ref object of RootObj
|
||||||
engine*: MyouEngine
|
engine* {.cursor.}: MyouEngine
|
||||||
width*, height*: int
|
width*, height*: int
|
||||||
format*: TextureFormat
|
format*: TextureFormat
|
||||||
depth_type*: FramebufferDepthType
|
depth_type*: FramebufferDepthType
|
||||||
|
@ -752,7 +753,7 @@ type
|
||||||
# loader_base.nim
|
# loader_base.nim
|
||||||
|
|
||||||
Loader* = ref object of RootObj
|
Loader* = ref object of RootObj
|
||||||
engine*: MyouEngine
|
engine* {.cursor.}: MyouEngine
|
||||||
shader_library*: string
|
shader_library*: string
|
||||||
shader_textures*: Table[string, Texture]
|
shader_textures*: Table[string, Texture]
|
||||||
# on_destroy*: OnDestroy
|
# on_destroy*: OnDestroy
|
||||||
|
@ -777,7 +778,7 @@ type
|
||||||
Body* = ref object
|
Body* = ref object
|
||||||
|
|
||||||
Screen* = ref object of RootObj
|
Screen* = ref object of RootObj
|
||||||
engine*: MyouEngine
|
engine* {.cursor.}: MyouEngine
|
||||||
width*, height*: int32
|
width*, height*: int32
|
||||||
orientation*: int8
|
orientation*: int8
|
||||||
viewports*: seq[Viewport]
|
viewports*: seq[Viewport]
|
||||||
|
|
Loading…
Reference in a new issue