Show Posts
|
|
Pages: [1] 2 3 ... 7
|
|
1
|
Crystal Space Development / General Crystal Space Discussion / How does CS embedding into WX work?
|
on: September 24, 2006, 06:54:17 am
|
|
It's not quite CS related, but still. I want to embed Irrlicht renderer into wxGTK, but I have no clue as where to start. I know CS runs perfectly inside wxGTK, so can anyone tell me where to search for the clues? Something has been said about X Window descriptor which differs from Windows Window descriptor (Irrlicht runs only inside wxMSW at the moment). So any ideas? Thanks.
|
|
|
|
|
2
|
Crystal Space Development / General Crystal Space Discussion / How to binary-read a file on VFS?
|
on: July 04, 2006, 12:40:15 pm
|
i need to rewrite this in VFS: FILE *f; f = fopen (filename, "rb"); if (f == NULL) return false; fread (&version, sizeof (TBXVersion), 1, f); so i tried this: csRef<iVFS> vfs; vfs = csQueryRegistry<iVFS> (obj_reg); csRef<iFile> f = vfs->Open (filename, VFS_FILE_READ); f->Read (version, sizeof (TBXVersion)); but i get errors: tbx.cpp: In member function `bool TBXFile::Open(char*)': tbx.cpp:14: error: no matching function for call to `iFile::Read(TBXVersion&, unsigned int)' /usr/local/include/crystalspace/iutil/vfs.h:134: error: candidates are: virtual size_t iFile::Read(char*, unsigned int) make: *** [obj/tbx.o] Error 1 so how to read structures? thanks.
|
|
|
|
|
9
|
Crystal Space Development / General Crystal Space Discussion / Re: How to color a mesh (wrapper)?
|
on: May 11, 2006, 12:51:27 pm
|
X3DDocument x3d_doc ("/this/models/workspace.x3d", obj_reg);
vector<X3DTransform> transforms = x3d_doc.GetTransforms (); const int NUM_OF_OBJS = transforms.size ();
cout << "num of trans = " << NUM_OF_OBJS << endl;
csRefArray <iMeshFactoryWrapper> x3d_objs_fact (NUM_OF_OBJS); csRefArray <iGeneralFactoryState> x3d_objs_fact_states (NUM_OF_OBJS);
for (int i = 0; i < NUM_OF_OBJS; i++) { csRef<iMeshFactoryWrapper> fw_tmp; csRef<iGeneralFactoryState> fws_tmp;
fw_tmp = engine->CreateMeshFactory ("crystalspace.mesh.object.genmesh", "one_of_obj_facts"); x3d_objs_fact[i] = fw_tmp; fws_tmp = scfQueryInterface<iGeneralFactoryState> ( x3d_objs_fact[i]->GetMeshObjectFactory ()); x3d_objs_fact_states[i] = fws_tmp;
x3d_objs_fact_states[i]->SetLighting (false); x3d_objs_fact_states[i]->SetManualColors (false);
// Add vetices and triangles
vector<csVector3> vertices = transforms[i].GetVertices (); vector<csTriangle> tris = transforms[i].GetTris ();
for (int j = 0; j < vertices.size (); j++) { x3d_objs_fact_states[i]->AddVertex ( csVector3 (vertices[j].x, vertices[j].y, vertices[j].z), csVector2 (0, 1), csVector3 (1, 1, 1), csColor4 (1, 1, 1, 1) ); } for (int j = 0; j < tris.size (); j++) { x3d_objs_fact_states[i]->AddTriangle ( csTriangle (tris[j].a, tris[j].b, tris[j].c) ); } x3d_objs_fact_states[i]->CalculateNormals ();
csVector3 translation = transforms[i].GetTranslation ();
csRef<iMeshWrapper> obj = engine->CreateMeshWrapper (x3d_objs_fact[i], "obj", room, csVector3 (0 + translation.x, 20 + translation.y, 0 + translation.z)); csRef<iGeneralMeshState> obj_state = scfQueryInterface<iGeneralMeshState> ( obj->GetMeshObject ());
obj_state->SetMaterialWrapper (null_mw); csRandomGen rnd; cout << "rnd.Get = " << rnd.Get () << endl; obj_state->SetColor (csColor (rnd.Get (), rnd.Get (), rnd.Get ())); cout << "IsManualColors = " << obj_state->IsManualColors () << endl; cout << "IsLighting = " << obj_state->IsLighting () << endl; }
|
|
|
|
|
12
|
Crystal Space Development / General Crystal Space Discussion / How to make a shade?
|
on: May 11, 2006, 05:44:19 am
|
|
As you probably know, I get only a single colored model. Although, you'll tell me how to color it, it won't be shaded. I mean it won't look like 3D as things like GenerateSphere look like. So the question is how to make a genmesh look like 3D (make it shaded)? A mesh is made of AddVertex and AddTriangle.
Thanks.
|
|
|
|
|
|