Closed StreetLevel closed 8 years ago
Another thing leaves me confused: I'm plotting some spheres (I don't know if i'm doing it the right way):
ThreeJS.mesh(vert...) <<
[
ThreeJS.sphere(.03/(1.4^x)), ThreeJS.material(Dict(:kind=> "basic",:color=>"red"))
] for vert in vertices
],
The vertices
julia> vertices
5-element Array{Array{Float64,1},1}:
[2.0,0.0,0.0]
[0.0,1.0,0.0]
[0.0,0.0,0.0]
[1.0,0.0,0.0]
[0.0,0.0,0.0]
are 5 points defining two tetrahedrons. But in the canvas only 4 spheres are drawed
Maybe you can tell me my error or the proper way to plot several meshes or particles.
Many thanks in advance!
Best, Max
Nice catch! I made a wrong assumption as to how Polymer treats Boolean attributes. Turns out, it just checks if it is set, in which case it turns out to be true and if not set, false. So if the wireframe keyword exists, then it sets the wireframe attribute as true on the Polymer end!
This bug affects all Boolean attributes, most notably the visible
attribute which is by default set to true
(and so can never be set to false!). I'll push a fix for this soon!
Thanks for the bug report again!
In the second problem, it seems that you are creating 2 spheres at the same location? The 3rd and last element in the vertices
array seem to be the same! ([0.0, 0.0, 0.0]
). The way you are doing it is correct!
Thank you for the fast response.
...yeah you're totally right. I collected the wrong vertices. Now it works like a charm:
Is transparency support?
Your package is genious. I will dig a little deeper into it in the next few weeks. In general, if i want to extend the interface what would be the route to go? To my knowledge this 2 steps should be all i have to do (correct me if i'm wrong):
render.jl
creating a Patchwork.Elem:function some_element(radius::Float64)
Elem(
:"three-js-keyword",
attributes = Dict(:r => radius)
)
end
assets/bower_components/three-js/three-js.html
create a new javascript<dom-module id="three-js-keyword">
e.g.<dom-module id="three-js-keyword">
<script>
Polymer({
is: 'three-js-keyword',
properties: {
...
passing the attributes and then calling the appropriate Threejs javascript code.
If I'm right, it should be relatively easy to implement some functionality out of threejs.org/examples/ e.g. some gui elements.
Best, Max
That looks cool!
Is transparency support?
Not yet! But I can add support for it pretty easily. Just a couple of keywords to be added to the three-js-material
Polymer element!
Your package is genious. I will dig a little deeper into it in the next few weeks.
Thank you for the compliment :smile:! And that sounds great. I think this package is in need of users (other than myself!) and feedback to isolate issues and suggest improvements, as you've seen so far.
In general, if i want to extend the interface what would be the route to go? To my knowledge this 2 steps should be all i have to do (correct me if i'm wrong):
The steps you've mentioned are the way to go to make the changes, but I'd prefer if the updates to the three-js.html
file goes to https://github.com/rohitvarkey/three-js and you do a bower update
here. Makes things cleaner. Modifying the file in bower_components
and just copying the changes to the other repo will work too!
Looking forward to your involvement!
Regards, Rohit
I've just pushed to master and fixed this bug. I'm filtering out any attributes with false
before an Elem is created to prevent this from happening.
Also master has support for transparency and opacity! Do check out the box.jl
example to see how to use them.
Do let me know if you need anything else!
Thank you. thats sounds pretty cool! i will test it as soon as i have time. Best Max
I think i found a minor bug:
results in plotting a wireframe although the wireframe paramter is set to false. Only removing the :wireframe keyword results in plotting the surfaces.
Best, Max