How does Jeff Lamarches script binds the texture to objects [duplicate] - objective-c

This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
Loading model using Jeff Lamarches script
Guys this might sound very newbie question anyway i'm very new to GLKit and OpenGL
I'm using the Jeff Lamarches scipt from here (https://github.com/jlamarche/iOS-OpenGLES-Stuff) to generate Objective C header file from Blender.
Let say I've created a cube and did UV mapping in Blender using some image suppose image.png.
So basically I would like to understand where in the header the information about the mapping of the texture on the 3D model is kept ? Because I see only the vertex coordinates and normals in it.
In his examples of the MeshVertexModel is a three field array i.e.
...
{/*v:*/{-0.351562, 0.828125, -0.242188}, /*n:*/{-0.183599, 0.982971, 0.005310}, /*t:*/{0.954205, 0.958702}},
...
But all I'm getting from generated header file is in following format
...
{/*v:*/{-0.351562, 0.828125, -0.242188}, /*n:*/{-0.183599, 0.982971, 0.005310}},
...

Found that similar issue has also Wavefront export, here http://projects.blender.org/tracker/index.php?func=detail&aid=30317&group_id=9&atid=498 in 2.63 Blender.
Just replacing the uv_layer = me.uv_textures.active.data by uv_layer = me.tessface_uv_textures.active.data helped to have generated texture coordinates.
Update : For the sphere and cube the script does not work normally, i.e. for Cube it does generate no vertices and for sphere it does generate the vertice of a circle, for other complecated objectes the patch works and generates all the data correctly.

Related

CGAL Reading and Writing OBJ Texture

Hoping someone could please provide a snippet to read and write OBJ files with CGAL including normals and UV.
The only way I can think of is to write a reader and writer.
Is there a simple way to extend or re-use the existing reader and writer?
Appreciate any guidance.
Bare minimum example. mesh-in.obj contains vt records, mesh-out.obj does not.
Mesh mesh;
CGAL::IO::read_polygon_mesh("mesh-in.obj", mesh);
CGAL::IO::write_polygon_mesh("mesh-out.obj", mesh);
Should I parse the vt records from the input OBJ file and append as named parameters?

Generate OPEN surface mesh from a set of 3D points

I have a set of points on an OPEN surface in 3D space.
I have identified a subset of points which lay on the boundary.
I mean to generate a triangulation of those points, which gives me an open surface and keeps my selected points on the boundary.
All references I found deal with (sometimes?) closed surfaces, e.g., CGAL.
See examples below.
In addition, some CGAL algorithms require oriented normals at each point, which I do not have.
Is there an available algorithm and code for this? (either CGAL Advancing_front_surface_reconstruction, properly handled, or any other)
See also this and this.
Example 1
I compiled and ran example reconstruction_surface_mesh.cpp from examples/Advancing_front_surface_reconstruction, out-of-the box (which uses file half.xyz as input for data points), and I obtained a closed surface:
I would like to get rid of the few triangles that close the surface.
I tried adding an extra point at the end of half.xyz, and I got
which is an open surface.
So far, with what I tested, I do not know:
How to indicate an open surface.
How to indicate which vertices lay at the boundary.
If this is a non-empty set (and it should have at least three vertices) this would imply an open surface.
Ideally, one would have a workflow which works without manual intervention.
Example 2
I compiled and ran example boundaries.cpp, out-of-the box (which also uses file half.xyz as input for data points).
The output is:
0 outliers:
Boundaries:
boundary
0.178269 0.438589 0.129521
0.0795598 0.419465 0.244812
0.0549683 0.377617 0.3119
-0.0295721 0.360972 0.329075
-0.111332 0.334417 0.342617
-0.186667 0.2953 0.346683
-0.2719 0.16555 0.375017
-0.336304 0.117058 0.339323
-0.393517 0.0775 0.285917
-0.421419 -0.126854 0.215271
-0.395217 -0.214417 0.20015
-0.354783 -0.2953 0.170767
-0.237067 -0.395867 0.172233
-0.178246 -0.438588 0.129553
0.0227767 -0.4873 0.0700833
0.220338 -0.438589 -7.23321e-06
0.293 -0.395867 0
0.36025 -0.334417 0
0.418077 -0.258382 6.0303e-05
0.46025 -0.17265 0
0.484417 -0.0425167 -0.0763333
0.485067 0.03875 -0.0782667
0.471547 0.117058 -0.076827
0.44605 0.197567 -0.0700833
0.4092 0.27125 -0.0433167
0.364885 0.329645 0
0.313633 0.377617 0.0441167
0.2509 0.41425 0.0879333
I did not find how to use this for
automatically removing triangles which would make my target boundary vertices not laying at the boundary.
Moreover, the output seems to be the list of boundary points, without the "spurious" triangles (I am not sure). I would like to specify this list.
The CGAL advancing front reconstruction algorithm does generate open surfaces in general.

VNImageRequestHandler init with pixels data

I would like to use a VNImageRequestHandler with raw pixels data. The method initWithData:options: of VNImageRequestHandler is not documented, and I can't find any example using this. What is the accepted format, and what is this "options" parameter ?
Apple documentation (empty) page : https://developer.apple.com/documentation/vision/vnimagerequesthandler/2866551-initwithdata?language=objc
Note that a CVPixelBuffer is basically a wrapper around raw pixel data. You can easily create one that points at your own pixel data using CVPixelBufferCreateWithBytes().

how to show the mesh in terrain or others in ogreļ¼Œ

http://i.stack.imgur.com/kcOxx.jpg
Look at the picture, I want to achieve something like this in OGRE, but I have no idea about this.
I am trying to make a SLG game with OGRE now, and the first step is to show the mesh.
I am a Chinese student and it's... My English grade is not good, and in my country I can only find a little doc about OGRE. The internet is filled with Unity3D... I thank for everybody who has read my question.
One way
Add to your object's .material script one more pass.
material myMaterial
{
technique
{
pass solidPass
{
// sets your object's colour, texture etc.
// ... leave what you have here
polygon_mode solid // sets to render the object as a solid
}
pass wireframePass
{
diffuse 0 0 0 1.0 // the colour of the wireframe (white)
polygon_mode wireframe // sets to render the object as a wireframe
}
}
}
This of course renders the object twice, but I assume it's just for debugging purposes and the lines are quite slim, also the object overlaps the wireframe at some parts.
The usual way
Add another texture_unit to the object's .material script that contains thin white squares of size the same as in the UV mapping (which you can export with most modelling software) with a transparent background
Make sure the .material script has alpha enabled in the pass you created
scene_blend alpha_blend
scene_blend_op add
This lets you choose what kind of lines you want.
Source:
Also check the OGRE Manual under Material Scripts. It goes much more in depth about the material script itself

Tesselation/CGR Details from CATPart_CATIA_API

I need to read the tessellation/cgr/visualisation details from a CATIA V5R18 Part file using CATIA V5R18 API.
Visualisation details such as:
Number of Vertices
Number of Triangles
Number of Strips
Number of Fans
Number of Normal
Bounding Sphere Centre and Radius
These details I have read from .cgr files using CAT3DRep/CATRep/CATSurfacicRep, but I am not able to read the same for .CATPart files.
From .CATPart with the help of CATIVisu I got CAT3DBagRep type, when I queried from PartFeatures. But to get Visualisation details I need CATSurfacicRep.
What interface should I query and from where should I query?
I am not sure about R18 but for R22 and R23 if you have the CAA documentation there is an example located at: C:\Program Files\Dassault Systemes\B23\CAADoc\CAATessellation.edu.
This example code has everything you need to get the tessellation data except normals and bounding spheres. I used this example code when I was teaching myself how to make a tessellated nurbs surface and it was quite useful for testing.