# HG changeset patch # User Sam # Date 1686760319 -25200 # Node ID b9f349ac7550f50fa605d301c3f9276195ddb453 # Parent 0eef4eba9c170b9a23bb78ad548ed97c78c4580d add: access to non-animated transform diff -r 0eef4eba9c17 -r b9f349ac7550 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: