Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1] 2
Print
Author Topic: Papervision and MVC  (Read 13422 times)
Tipz
Full Member
***
Posts: 20


View Profile Email
« on: April 27, 2009, 02:14:45 »

Hi guys am planning on using puremvc on my next papervision project. Whats the best way to implement papervision with multicore. Does each of the facade have its own Viewport3D or just the 3d objects? Also whats the best way to control the camera across all facades.

any help would be appreciated
cheers
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: April 27, 2009, 05:37:09 »

This will really depend a lot on what you're doing in each module. If all the rendering takes place in one module, then you don't have a problem coordinating the camara amoungst them.

We'll need to understand more about your intended architecture.

-=Cliff>
Logged
Tipz
Full Member
***
Posts: 20


View Profile Email
« Reply #2 on: April 27, 2009, 09:03:40 »

Thanks for the quick reply Cliff. I must tell you i love coding using the pureMVC framework. Made my life so much easier.

Ok about the papervision project. It is a flash website, am using flashdevelop and Flex SDK to develop it. Here is what am planning to to.  There is going to be an intro logo in 3d on clicking the logo more 3d objects would be added to the scene. Each object would represent for eg: "services", "contact" etc... On clicking these objects some events would take place.

I would like to have the main facade as the background and keep each object as its own facade. Then here is my confusion how do i add all these objects to one 3d scene.

Cheers
« Last Edit: April 29, 2009, 02:05:57 by Tipz » Logged
meekgeek
Full Member
***
Posts: 25


View Profile Email
« Reply #3 on: April 29, 2009, 10:13:35 »

I too would like to know how to best develop something like this.

My company and I just completed a project similar to this.  I love this framework and used the Alternativa Platform.  The issue with this is that all of the 3d engines out there are so closely tied to the stage.  I would like to find something out there better suited for the framework.

My solution was kind of messy but it worked for now.  I basically placed most of my 3d code in the main module class, which extends “PipeAwareModule.”  The Mediator that mediates that class can then register other mediators to mediate parts of the engine if you need to.

Anyway, like I said, don’t think this is the best solution but it worked for me.

Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #4 on: May 02, 2009, 09:56:25 »

Check out the way the Modularity demo has a shell that allows modules to add components to a canvas owned by the app. To do so it exposes an interface that the modules call to add or remove a visual component.

You could have a module that owns the 3D scene and allow other modules to add objects to the scene that way.

You could also follow the path of PipeWorks, where instead modules calling interface methods on each other, they request components be manufactured and exported using messages. So a module that generates Spheres could receive a request for a sphere of a certain radius and number of points, say. It would create the sphere (possibly registering a mediator for it) and export it via a message on a pipe leading to a module that takes the sphere and places it in the scene.

Why might the sphere need a mediator? Because you might also send notifications to the sphere module that says turn on shading for a given sphere or all spheres.

In your case the module may generate the various 3d menu objects, which you want mediators to be listening for and sending out messages (or making interface calls) to other modules to make things happen.

-=Cliff>
Logged
Tipz
Full Member
***
Posts: 20


View Profile Email
« Reply #5 on: May 13, 2009, 10:13:40 »

Thanks for your reply Cliff. I tried the module way am able to add and remove 3d objects that way. The problem arises when i want to control the camera. I want to have access to this one camera that is created in the shell. What is the best way for other modules to have access to this? I was thinking of having a global variable with the camera, but not sure if this is the way forward. Any suggestions?

Cheers
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #6 on: May 13, 2009, 11:19:38 »

Why not have a camara module that you send messages to when you want it to do something? Can you explain why you need to grab access to the camara everywhere?

-=Cliff>
Logged
Tipz
Full Member
***
Posts: 20


View Profile Email
« Reply #7 on: May 13, 2009, 11:39:03 »

Thanks for the quick reply. May be i dont get the concept as am not a seasoned programmer, thanks for your patience. Here is my problem. Say i create 3 modules (what i mean by modules is having its own facade) each being a 3d object. When i add the first module to the widgitshell using the interface, i would like to make some camera movements, like wise for the other two modules. So if i had access to the camera within each of the modules i could control it.  This way each of the modules have its own camera movement.

Cheers
Tipz
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #8 on: May 14, 2009, 05:41:48 »

But then each of the modules necessarily needs to be able to drive the camara, and thus you'll spread a lot of the same logic around the app.

Consider the distribution of responsibility on a movie set. There's one camaraman, and lots of actors to shoot. The actors don't trouble themselves with making sure the camara's pointed at their good side. That's the job of the director who's looking over the camaraman's shoulder and at the set. The director gives queues to the camaraman as well as the actors.

This may seem a bit tangential, but building an OOP app is often analagous to building a specialized team of people, because you're taking the work to be done and imbuing various classes with various roles and responsibilities.

In a company where people 'wear lots of hats', often it means that not much thought has been given to distribution of responsibility, and people often don't know who to go to for what. In a company where people have clearly assigned roles and responsibilities, you always know who to go to for what.

So back to your modules. What if there was a director module and a camaraman module, and the director was the one that actually placed the actors on the stage and coordinated their appearance with camaraman to make sure the camara was pointed the right direction when they entered?

-=Cliff>
Logged
Tipz
Full Member
***
Posts: 20


View Profile Email
« Reply #9 on: May 14, 2009, 10:03:56 »

Thanks for that i now understand the concept.

This is how i see it.
1. Using widgitshell as my papervision base class i can add and remove other modules (3d objects) through the iwidgit interface.
2. If i use widgitshell as my papervision base class i would need to use this papervsion method
:
renderer.renderScene(default_scene, default_camera, viewport); which runs on enterframe event, to render the 3dscene.
3. Now if i have the camera as a module do i pass the camera through the iwidgit interface to be rendered?
4. How would the widgitshell pass information about modules being added, to the camera, so the camera could make appropriate movements?
5. Is there a way the modules could communicate with each other?

when you say module, do you mean a package with its own facade?

Cheers
« Last Edit: May 14, 2009, 10:07:55 by Tipz » Logged
Jason MacDonald
Sr. Member
****
Posts: 243


View Profile Email
« Reply #10 on: May 14, 2009, 10:28:21 »

5. Is there a way the modules could communicate with each other?


You can use an interface, the Pipes Utility or Fabrication.
Logged
Tipz
Full Member
***
Posts: 20


View Profile Email
« Reply #11 on: May 14, 2009, 12:16:48 »

Thanks for your reply mate, i am from a designer background no programming knowledge what so ever. Started getting my head around as3 and was beginning to get my head around PureMVC, now i need to learn plumbing and fabricating  :o. Is it ever gonna stop... :'(.

Had a look at Fabrication, its really interesting, never knew it existed. Would you say using Fabrication is better than just pureMVC multicore and pipeworks?

Cheers
Logged
Jason MacDonald
Sr. Member
****
Posts: 243


View Profile Email
« Reply #12 on: May 14, 2009, 01:50:24 »

Thanks for your reply mate, i am from a designer background no programming knowledge what so ever. Started getting my head around as3 and was beginning to get my head around PureMVC, now i need to learn plumbing and fabricating  :o. Is it ever gonna stop... :'(.

Had a look at Fabrication, its really interesting, never knew it existed. Would you say using Fabrication is better than just pureMVC multicore and pipeworks?

Cheers

It's easier to get going with Fabrication, in my opinion. But Fabrication is, at it's heart, a wrapper to simplify the use of Multi-core and Pipes. It still uses pipes and multi-core to accomplish it's communication between modules, it just helps you avoid doing the nitty-gritty part of hooking-up and managing the pipes between modules.

If you are the type of person who likes to really understand how the plumping (pun not intended) works, then try using Pipes with Multi-core on their own. If you just wanna get going fast, and write a little less boiler plate code in the process, use Fabrication (it also has some additional features).
« Last Edit: May 14, 2009, 01:55:15 by Jason MacDonald » Logged
Tipz
Full Member
***
Posts: 20


View Profile Email
« Reply #13 on: May 15, 2009, 12:12:33 »

Thanks for your reply Jason. Does using Fabrication in any way divert from the mvc framework.
Logged
Jason MacDonald
Sr. Member
****
Posts: 243


View Profile Email
« Reply #14 on: May 15, 2009, 05:56:21 »

Thanks for your reply Jason. Does using Fabrication in any way divert from the mvc framework.

No. It's just an extension built on top of PureMVC to making communication with modules simpler. Underneath it's still PMVC and Pipes.
Logged
Pages: [1] 2
Print