small fixes
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
f96da63987
commit
eff722ea05
@ -0,0 +1,21 @@
|
||||
# 3DOM
|
||||
|
||||
A SceneGraph written as if it's a DOM
|
||||
|
||||
```kt
|
||||
fun main() {
|
||||
val doc = Document()
|
||||
val node = doc.createNode<PlainNode>()
|
||||
node.model { setTranslation(10, 30, 3) }
|
||||
|
||||
doc.on<DOMTreeUpdate.Insert> { (ev) ->
|
||||
println("Node has been added at ${ev.absolute.translation}")
|
||||
}
|
||||
|
||||
doc.addNode(node)
|
||||
|
||||
doc.inRange(Vector3d(0, 0, 0), 50).forEach {
|
||||
println("Node found at ${it.absolute.translation}")
|
||||
}
|
||||
}
|
||||
```
|
@ -1,10 +1,25 @@
|
||||
package me.eater.threedom.dom
|
||||
|
||||
import me.eater.threedom.dom.query.NodeQuery
|
||||
import org.joml.Vector3dc
|
||||
|
||||
interface INodeQueryCapable {
|
||||
/**
|
||||
* Get node inside this node by [id]
|
||||
*/
|
||||
fun getNodeById(id: String): INode<*>?
|
||||
|
||||
/**
|
||||
* Get all nodes inside this node with the class [className]
|
||||
*/
|
||||
fun getNodesByClassName(className: String): Sequence<INode<*>>
|
||||
fun find(query: NodeQuery): Sequence<INode<*>> = emptySequence()
|
||||
fun findOne(query: NodeQuery): INode<*>? = find(query).firstOrNull()
|
||||
|
||||
/**
|
||||
* find all nodes inside this node in region between [pointA] and [pointB]
|
||||
*/
|
||||
fun findInRegion(pointA: Vector3dc, pointB: Vector3dc): Sequence<INode<*>>
|
||||
|
||||
/**
|
||||
* find all nodes inside this node in [range] of [origin]
|
||||
*/
|
||||
fun findInRange(origin: Vector3dc, range: Number): Sequence<INode<*>>
|
||||
}
|
||||
|
Loading…
Reference in New Issue