# HG changeset patch # User Sam # Date 1686760319 -25200 # Node ID 42e692716e38bce05d6f9c51044fc9099ee9c5f4 # Parent 8a1c04f64f3d49f751d0bdd01ee40363ec0e4df1 add: access to non-animated transform diff -r 8a1c04f64f3d -r 42e692716e38 src/semicongine/scene.nim --- a/src/semicongine/scene.nim Wed Jun 14 22:56:43 2023 +0700 +++ b/src/semicongine/scene.nim Wed Jun 14 23:31:59 2023 +0700 @@ -54,6 +54,23 @@ func getValue*(animation: var EntityAnimation): Mat4 = return animation.player.currentValue +func transform*(entity: Entity): Mat4 = + result = entity.internal_transform + for component in entity.components.mitems: + if component of EntityAnimation: + result = result * EntityAnimation(component).getValue + +func originalTransform*(entity: Entity): Mat4 = + entity.internal_transform + +func `transform=`*(entity: Entity, value: Mat4) = + entity.internal_transform = value + +func getModelTransform*(entity: Entity): Mat4 = + result = entity.transform + if not entity.parent.isNil: + result = entity.transform * entity.parent.getModelTransform() + func addShaderGlobal*[T](scene: var Scene, name: string, data: T) = scene.shaderGlobals[name] = newDataList(thetype=getDataType[T]()) setValues(scene.shaderGlobals[name], @[data]) @@ -224,20 +241,6 @@ queue.add child yield next -func transform*(entity: Entity): Mat4 = - result = entity.internal_transform - for component in entity.components.mitems: - if component of EntityAnimation: - result = result * EntityAnimation(component).getValue - -func `transform=`*(entity: Entity, value: Mat4) = - entity.internal_transform = value - -func getModelTransform*(entity: Entity): Mat4 = - result = entity.transform - if not entity.parent.isNil: - result = entity.transform * entity.parent.getModelTransform() - proc prettyRecursive*(entity: Entity): seq[string] = var compList: seq[string] for comp in entity.components: