Crystal Space
Welcome, Guest. Please login or register.
October 01, 2014, 11:35:49 pm

Login with username, password and session length
Search:     Advanced search
9020 Posts in 2053 Topics by 8569 Members
Latest Member: Embingos
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  some question about portal and creating mirror
« previous next »
Pages: [1] Print
Author Topic: some question about portal and creating mirror  (Read 1861 times)
Jr. Member
**
Posts: 81


View Profile Email
« on: November 22, 2008, 07:49:03 am »

    I am new in CS and CEL;
    I have used 3ds max to build a simple world which includes two sectors and a portal, and i have used portal to connect the two sectors so the actor can go through from one sector to another by portal . Now I want to change this portal to mirror using C++, but I don't know how to do it ? Can you help me ?!
    And in Cel's tutorial "walktut", if i want to get " iportal" interface how can i do ? Which function can i use?

Thank you very much!!
   
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #1 on: November 22, 2008, 08:17:29 am »

Quote from:  link=topic=1779.msg7932#msg7932 date=1227336543
    I am new in CS and CEL;
    I have used 3ds max to build a simple world which includes two sectors and a portal, and i have used portal to connect the two sectors so the actor can go through from one sector to another by portal . Now I want to change this portal to mirror using C++, but I don't know how to do it ? Can you help me ?!
    And in Cel's tutorial "walktut", if i want to get " iportal" interface how can i do ? Which function can i use?

Thank you very much!!
   

To set up in a mirror in C++ you can use iPortal->SetMirror() function. Check the API documentation for more information.

To get the reference to an iPortal you first have to find the portal. Portals are mesh objects like any other and they have names. So you can do iEngine->FindMeshObject() to find the mesh that represents the portal container. That will give you a mesh that contains the portals. Usually such a mesh contains only one portal (that depends on how the level is constructed). So you can do:

Code:
iMeshWrapper* portal_mesh = engine->FindMeshObject("portal_mesh_name");
csRef<iPortalContainer> portal_container = scfQueryInterface<iPortalContainer> (portal_mesh->GetMeshObject ());
// Assuming we only have one portal we get the one with index 0:
iPortal* portal = portal_container->GetPortal (0);

Hope this helps,

Greetingds,
Logged
Jr. Member
**
Posts: 81


View Profile Email
« Reply #2 on: November 23, 2008, 08:42:59 am »

    Thank you very much for your help!!  But it till have some problems.
    I have changed the portal to mirror successfully. But the  effect of rendering in screen is not stabilization, only the actor walks closed enough to the mirror ,   the effect of the mirror can render well.


   But if the actor far from the mirror or the angle of camera is changed  , the mirror becomes like a wall again , I don't know why?!


Logged
Jr. Member
**
Posts: 81


View Profile Email
« Reply #3 on: November 23, 2008, 08:46:26 am »





Logged
Jr. Member
**
Posts: 81


View Profile Email
« Reply #4 on: November 23, 2008, 11:09:05 am »

     sorry, I have another question about portal.
     I use the function of virtual const csVector3 *  GetWorldVertices ()=0 of iPortal interface to get the portal's vertex, but using this function i only can get one vertex of the portal if i want to get the four vertices of portal, how can i do??
     
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 5.383 seconds with 13 queries.