Crystal Space
Welcome, Guest. Please login or register.
April 24, 2014, 04:56:49 pm

Login with username, password and session length
Search:     Advanced search
8990 Posts in 2037 Topics by 7626 Members
Latest Member: Danielmarini
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  Texture mapping functions
« previous next »
Pages: [1] Print
Author Topic: Texture mapping functions  (Read 894 times)
eventhorizon5
Jr. Member
**
Posts: 53


View Profile WWW
« on: August 07, 2010, 07:43:46 pm »

I'm finally trying to move the rest of my simulator app off of thing meshes and onto genmeshes.  This is about the first issue I'm having (the 2nd one has to do with polygon cuts, but I think I know how I'll do that).

My app currently doesn't use any static 3D models, and generates everything on the fly.  About 1/3 of it is using genmeshes already.  The Thing mesh system (specifically iThingFactoryState) had numerous texture mapping convenience functions, mainly this implementation of SetPolygonTextureMapping (the one I use):

virtual bool iThingFactoryState::SetPolygonTextureMapping  ( const csPolygonRange &  range, const csVector3 &  p1, const csVector2 &  uv1, const csVector3 &  p2, const csVector2 &  uv2, const csVector3 &  p3, const csVector2 &  uv3 )

With that function, a list of 3 abstract vertices along with their UV mappings are specified, and the important part is that they're abstract - they don't have to match up with actual polygon vertices (extra math is done to calculate the full mapping matrix with values adjusted to the actual vertex positions).  With the newer Genmesh system, the only way (as far as I know) to perform manual texture mapping is to specify a list of UV coordinates for each vertex, which becomes a problem when you're dealing with abstract coordinates like I mentioned before (ones that don't match up with any polygon coordinate, but are readjusted by the mapping functions).  Does anyone know if there are functions to help perform this kind of texture mapping with the genmesh system?  Right now I'm thinking that I'll have to somehow use the calculation code from the old thingmesh system, but I don't know if it'll work properly with genmeshes.

-eventhorizon
« Last Edit: August 07, 2010, 11:40:45 pm by eventhorizon5 » Logged
kickvb
Global Moderator
Jr. Member
*****
Posts: 79


View Profile
« Reply #1 on: August 08, 2010, 04:47:08 pm »

There are some mapping tools for genmeshes, see CS::Geometry::TextureMapper. I'm not experienced in them, so I can't say if they can be useful for you, maybe you will need to implement a new mapper.
Logged
eventhorizon5
Jr. Member
**
Posts: 53


View Profile WWW
« Reply #2 on: August 08, 2010, 07:33:38 pm »

There are some mapping tools for genmeshes, see CS::Geometry::TextureMapper. I'm not experienced in them, so I can't say if they can be useful for you, maybe you will need to implement a new mapper.


That's actually what I'm using (TableTextureMapper) which only allows a list of UV coordinates for each polygon vertex.

-eventhorizon
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 3.325 seconds with 14 queries.