Should be possible because a Tool doesn't have to be of a particular class, it just has to implement an informal protocol. What that means is you can just send onLButtonDoubleClick (or onMButtonDoubleClick) to the Tool and it will do its thing.
Adam
Should be possible because a Tool doesn't have to be of a particular class, it just has to implement an informal protocol. What that means is you can just send onLButtonDoubleClick (or onMButtonDoubleClick) to the Tool and it will do its thing.
Adam
I initially implemented skyboxes in pure Ruby in SU.
# skybox functionality
class MyViewObserver < Sketchup;;ViewObserver
def initialize(stub)
.. build a definition using 'stub' as filepath
skybox = Sketchup.active_model.definitions[dname]
@skybox = Sketchup.active_model.entities.add_instance skybox, Geom;;Transformation.new
@skybox.locked= true
end
def onViewChanged (view)
@skybox.locked= false
@skybox.move! view.camera.eye
@skybox.locked= true
end
def remove
@skybox.locked= false
Sketchup.active_model.entities.erase_entities @skybox
end
end
def add_skybox
$skybox = MyViewObserver.new("~projects/Ruby/skybox/space1")
Sketchup.active_model.active_view.add_observer($skybox)
end
ie Sketchup will move the skybox along with your camera. Works OK - only let down by SU crazily aggressive bounds on Z when it draws.
Adam
@alan fraser said:
Texture Maker will generate a cgi landscape and sky and export it in a variety of formats...including a skybox. Screenshot and result attached below.
Sky boxes are used extensively in games and work very well. They can be used well in SU, as Adam says, but only really from a very fixed viewpoint....that being the centre of the cube.
Games get around this by locking the skybox to the viewer. As you move through a first person perspective shoot-em-up the skybox moves with you, so always appears in the correct perspective and always infinitely distant. This obviously isn't the case in SU.
I realise this thread has drifted slightly away from Ruby, but there's a challenge for somebody.
Skyboxes can work well in SU, but generally only if you move a few feet...or catch a glimpse out of a window, not up and down streets. Of course you can make them really huge, so that any novement by the viewer is very slight in comparison...but then you get clipping problems.The simplest solution is simply to map a panoramic image around a cylinder. Here is a very old thread from the old forum, now transferred to Google Groups. So old, in fact, that it predates SU's ability to map around cylinders, so I had to do it by slicing the image into sections...but the resulting skps still work ok for most situations.
@alan fraser said:
Skyboxes don't work at all well in SU...the corners are way too obvious. Skydomes are a much better alternative, or you can even go with simple cylinders if you don't look up too much. I have created a number of skydomes for SU. There is a quick example of one here.
The quality of the YouTube video is pretty awful, but it gives a rough idea of the kind of immersive environment that is possible in SU.
Well if you do it "right" you cannot see any seams using a skybox.
(Watch the video link I posted to confirm this)
Adam
@jclements said:
Very cool!
Did you have to use a special photo or technique so it would map seamlessly? I am assuming the photo is mapped to the inside of a cylinder.
No, its a technique commonly used in video games called a "skybox". There are 6 photos (left,right,back,front,up,down) mapped to 6 faces of a inverted cube. If you google "skybox" you should find some examples. In the plugin you just choose the file you want in the preferences.
Adam
Towards the end it shows a complete skybox all done within Sketchup.
Here's a link of the latest video.
@unknownuser said:
I am open for creating a bridge between Podium and Adam's plugin, maybe an open format that allows exchanging of info
Right now my head is buried in finishing this thing. When the dust settles, I get some sleep, then sometime we should have a chat. But as I've said before, these are totally different architectures attempting to solve essentially different problems. My concern is trying to whack a square peg into a round hole in the expectation something wonderful will come out of it, is a road to disappointment for developers and users.
Right now my focus is fast, interactive walkthrough of models with lighting to give a flavor of the space.
The lighting I use is non-physically based, it is biased, it is an approximation. But its really effective of giving a sense of a place and its very very fast.
So. Sure we should talk. But lets not get ahead of ourselves here. Perhaps these is a useful crossover but I'm having trouble understanding what it is. Thats all.
And when is 2.0 out? 
All the best,
Adam
@adamb said:
Yes, having done the 40% of the work to show a prototype I'm very hard at work doing the other 90% to make it a product.
As promised, here's a grab of the ambient occlusion lighting (BTW 3.6 seconds to generate):
Adam
OK, "your mileage may vary". Just ran this test room again, it took 0.3 seconds to generate, so just 10x for this model.. 
First off apologies for being so quiet. There's been a huge amount of development on this and its coming along really nicely.
So where are we up to? Well, originally I wanted something cross platform and simple to implement. And for as long as I used simple geometry and didn't expected too much all was good... However. (There is always a 'however'), it became clear to me from my own experiments and speaking with those who have a passing understanding of how SU works, that for realworld models like you guys actually produce my plans would have to change. So the past months I've been redoing/refactoring functionality in C++, simultaneously developing on Mac OSX and Win32 (they are in lockstep development-wise) . Unsurprisingly the new version is around 20-30x faster than the old, supports blending SU textures with lighting, transparency (and I plan on having a few other pretty cool features).. So a colossal amount of work later, something that was some neat algorithms in a largish script has become a fullblown engine.
I do plan on wrapping up development in March so its not going to be too long after that I can have it for sale. I wasn't expecting to have to implement so much technology, so my timing is off from what I initially expected (late software? never!) but fingers crossed I can nail some bugs which have been stopping me posting pics/video RSN.
As always, thanks for all you enthusiasm!
Adam
And how many millimeters in an inch (the native units of Sketchup) are there?
@pixero said:
First, sorry for not getting back earlier. Its been kind of hectic here.
When using your method and just translating the xDist it gets a transform also in th z axis and if I use the value 100 as xDist it gets moved a distance of 2540 mm?
Unfortunately, I think you just have to observe them by adding an instance of this:
class MyInstanceObserver < Sketchup;;InstanceObserver
def onOpen(inst)
puts "onOpen"
end
def onClose(inst)
puts "onClose"
end
end
Yes, I am planning on supporting textures. However, if it turns out I can't, I won't. 
No different. Just wasn't sure whether you can get the camera matrix as a whole, so thought it just as easy to do 3 dot products. (And we do just want a 3x3 tranform here).
Ah, ok. So you need to transform your x-length,y-length,z-length into world space.
camera_space_translation = Geom::Vector3d.new(xDist,yDist,zDist)
then
world_space_translation = Geom::Vector3d.new(view.camera.xaxis.dot(camera_space_translation),
view.camera.yaxis.dot(camera_space_translation),
view.camera.zaxis.dot(camera_space_translation))
(do whatever with world_space_translation)
BTW This is just a long hand vector-matrix multiply.
view.camera.xaxis
view.camera.yaxis
view.camera.zaxis
give you the camera space frame. (xaxis is left/right, yaxis is up/down, zaxis is along camera dir).
I don't use Podium myself, but looking at your settings wouldn't:
<Parameter Name="Max Objects per Cell" Type="Integer" Value="20"/>
be worth reducing? You may get a good space-time trade-off - we all have lots of memory nowadays.
Adam
@tony said:
I don't suppose these is a way you would let the public take a look at the tool at it stands?
Tony
Unfortunately not. I'm not happy with it, so you won't be either. To be a really good "fire and forget" tool, it has to handle anything you throw at it sensibly. But its coming on in leaps and bounds - I'm on in fulltime right now - so hang in there. And thanks for the continued interest!
Adam
@unknownuser said:
I'm bumping this thread, hoping to hear what progress is like. AdamB?
Yes.. been busy. Making really good progress; I now have it running natively on Mac and PC (so its 3x faster), blending ambient occlusion pass and direct lighting which gives stunning results, focussing on workflow to make it easier to tweak lighting, finding 'n' fixing bugs, testing testing testing.
Hopefully I'll be able to post some pics / youtube stuff RSN.
Adam
I've adopted the sketchup protocol of implementing a method called version_number in your main Module. I use a format of majorversion.minorversion{a-z}
The letters being patches / bug fixes to minor versions.
Adam
@didier bur said:
Suggested by AdamB, a quick access to all your help files of the Plugins folder and its sub-folders. It's here:
http://www.sketchucation.com/forums/scf/viewtopic.php?f=153&t=5421
Much as I like to take credit for other peoples work
, the idea was "Dave R", not mine. But top job turning an idea into a reality, Didier.
AdamB