As the freshly baked readme file says, this prototype client is an attempted switch from legacy ps code to:
As to the code, it’s ugly prototypes and messy and all that but anyway, perhaps best to start with the “basic” versions of Getters I wrote for CS’s “factories” of meshes, hoping that I could perhaps simplify a bit the full thing on this side. To understand what I’m talking about here: to create anything at all in CS, you’ll need first the “factory” for that type of thing since the idea is that it’s more efficient this way; which it is, sure, but only if you ever want to create a lot of very-similar-things in the same place like that, which happens ~never and so, as a result, all this does is that ~every thing you create ends up with its additional unique factory too!
Add to the above the maddening fact that CS uses strings – and it’s CPP code so strings are a pain at all times, of course – as IDs for everything so you have to search for factories as well as for objects by their *name*. Oh, and each factory is created through a call that requires also the *name* of the SCF plugin that provides the type of… factory you are after. Think of it: since you have factories to create “same sort of” objects, it follows that the factories themselves represent already types of objects, right? Sure, but why not have then also types of factories to make things more… hm, interesting? So there we go, there are also types of factories and plugins that implement (or not) those types and it’s true that in general there’s only one plugin for each type but don’t let that stop you from having the oh-so-useful-mechanism for having more than one type because there’s now no real cost to all this, no, none at all, right? Fine, first let’s set those plugin names to something shorter at least and give the “types” some numbers too, I like numbers:
Similar Getter method for a texture, using the given name as path too since one string is anyway enough of a mess in there, no need for two. The loader thing is simply CS’s way of reading an image file, since the texture here is simply assumed to be an image (.png, .bmp, .jpg, .dds are all supported):
The equivalent for a Material is potentially more dubious because on one hand CS *anyway* wraps all textures into materials with the same name and on the other hand, a material also holds shader variables of all sorts, with the basic texture set as a “shader variable” itself! Moreover, shader variables can have different data types, what joy. So this one is not all that basic: it queries the client’s data cache (via that SMG object) to retrieve all shaders and variables for this material and applies them as they come:
Using the above, a prototype method that creates a sky as a sphere with the fixed “starry” image painted on the inside, since your world is – of course! – all inside of the sky dome, in this grand vision of computer graphics . Note that both the texture and the location (aka sector) of the sky are hardcoded in this hasty prototype:
For an example, the test made with the moon, effectively creating an object in the world directly through the list of vertices and texture coordinates (as taken from its existing xml file otherwise, don’t look weirdly at me when you get to that huge list of vertices, they have been there all the time):
csRef EuLoader::GetMoon() {
csRef fact;
csRef state;
csRef type;
type = csLoadPluginCheck ( psengine->GetObjectRegistry(), GENERIC_PLUGIN, false);
if (!type)
Err::FatalError(“EuLOADER: can’t find crystalspace.mesh.object.genmesh plugin\n”);
fact = type->NewFactory ();
state = scfQueryInterface (fact);
//material
char matname[11] = “waves.dds”;
csRef mat = GetMaterial(matname);
if (mat == 0)
Err::FatalError(“EuLOADER: can’t find material waves.dds”);
fact->SetMaterialWrapper(mat);
//renderbuffer: position
const float posElems[] = {-24.46479416,4.86635208,16.66710281,-20.80559731,4.13849306,21.21320534,-21.21320534,0.00000000,21.21320343,-24.94408798,0.00000000,16.66710663,-20.80559731,4.13849258,-21.21320343,-24.46479607,4.86635256,-16.66710663,-24.94409180,0.00000000,-16.66710663,-21.21320343,0.00000000,-21.21320343,-27.18382263,5.40720034,11.48050213,-27.71638680,0.00000000,11.48050308,-16.34685135,3.25159287,-24.94409180,-16.66710663,0.00000000,-24.94409180,-28.85818863,5.74025345,5.85270882,-29.42355728,0.00000000,5.85271072,-11.25990391,2.23973608,-27.71638680,-11.48049831,0.00000000,-27.71638680,-29.42355919,5.85271168,0.00000358,-30.00000000,0.00000000,0.00000226,-11.25990868,2.23973703,27.71638870,-5.74025154,1.14180899,29.42355728,-5.85270977,0.00000000,29.42355728,-11.48050308,0.00000000,27.71638680,-5.74024439,1.14180756,-29.42355919,-5.85270309,0.00000000,-29.42355919,-28.85819244,5.74025393,-5.85270500,-29.42355919,0.00000000,-5.85270643,-16.34685326,3.25159311,24.94408607,-16.66710663,0.00000000,24.94408798,-27.18382263,5.40720034,-11.48049831,-27.71638680,0.00000000,-11.48049831,-10.60659599,4.39340019,-27.71638680,-15.39839554,6.37822866,-24.94409180,-16.34685135,3.25159287,-24.94409180,-11.25990391,2.23973608,-27.71638680,-27.71638489,11.48050785,0.00000358,-27.18381882,11.25991058,5.85270882,-10.60660172,4.39340210,27.71638870,-5.40719748,2.23973894,29.42355728,-5.40719128,2.23973608,-29.42355919,-5.74024439,1.14180756,-29.42355919,-27.18381882,11.25991058,-5.85270500,-15.39839745,6.37822914,24.94408607,-25.60660172,10.60660458,-11.48049831,-19.59844398,8.11794472,21.21320534,-23.04533005,9.54569340,-16.66710663,-23.04533005,9.54569244,16.66710281,-19.59844208,8.11794472,-21.21320343,-25.60660172,10.60660458,11.48050213,-15.39839554,6.37822866,-24.94409180,-17.63813210,11.78542995,-21.21320343,-20.74024582,13.85819817,-16.66710663,-23.04533005,9.54569340,-16.66710663,-19.59844208,8.11794472,-21.21320343,-23.04533005,15.39840508,11.48050213,-20.74024582,13.85819626,16.66710281,-23.04533005,9.54569244,16.66710281,-25.60660172,10.60660458,11.48050213,-13.85818863,9.25975227,-24.94409180,-24.46478844,16.34685707,5.85270882,-27.18381882,11.25991058,5.85270882,-9.54568291,6.37822866,-27.71638680,-24.94408607,16.66711426,0.00000358,-27.71638489,11.48050785,0.00000358,-9.54568672,6.37823105,27.71638870,-4.86634779,3.25159669,29.42355728,-4.86634254,3.25159264,-29.42355919,-24.46478844,16.34685707,-5.85270500,-27.18381882,11.25991058,-5.85270500,-13.85818958,9.25975323,24.94408607,-15.39839745,6.37822914,24.94408607,-23.04533005,15.39840508,-11.48049831,-25.60660172,10.60660458,-11.48049831,-17.63813210,11.78542995,21.21320534,-19.59844398,8.11794472,21.21320534,-19.59844017,19.59844971,-11.48049831,-20.80558968,20.80560303,-5.85270500,-14.99999523,15.00000477,21.21320534,-11.78542042,11.78543091,24.94408607,-17.63812828,17.63813782,-16.66710663,-17.63812637,17.63813782,16.66710281,-14.99999428,15.00000477,-21.21320343,-19.59844017,19.59844971,11.48050213,-11.78541756,11.78542995,-24.94409180,-20.80558777,20.80560303,5.85270882,-8.11793423,8.11794472,-27.71638680,-21.21319962,21.21320915,0.00000358,-8.11793709,8.11794853,27.71638870,-4.13848686,4.13849735,29.42355728,-4.13848305,4.13849211,-29.42355919,-6.37821770,9.54569435,-27.71638680,-9.25973988,13.85819817,-24.94409180,-16.66710091,24.94409561,0.00000358,-16.34684372,24.46479797,5.85270882,-6.37821913,9.54569721,27.71638870,-3.25158596,4.86635780,29.42355728,-3.25158310,4.86635208,-29.42355919,-16.34684372,24.46479797,-5.85270500,-9.25974178,13.85819912,24.94408607,-15.39839363,23.04533958,-11.48049831,-11.78541756,17.63813972,21.21320534,-13.85818386,20.74025345,-16.66710663,-13.85818291,20.74025345,16.66710281,-11.78541660,17.63813972,-21.21320343,-15.39839363,23.04533958,11.48050213,-9.54567719,23.04533386,16.66710281,-8.11793327,19.59844971,21.21320534,-8.11793232,19.59844971,-21.21320343,-9.54567909,23.04533386,-16.66710663,-10.60659409,25.60660934,11.48050213,-6.37821627,15.39840508,-24.94409180,-11.25989437,27.18382645,5.85270882,-4.39338970,10.60660553,-27.71638680,-11.48049545,27.71639252,0.00000358,-4.39339066,10.60660839,27.71638870,-2.23972821,5.40720701,29.42355728,-2.23972631,5.40719986,-29.42355919,-11.25989437,27.18382645,-5.85270500,-6.37821770,15.39840698,24.94408607,-10.60659409,25.60660934,-11.48049831,-5.74023724,28.85819435,-5.85270500,-5.85270023,29.42356491,0.00000358,-3.25158167,16.34685898,24.94408607,-2.23972559,11.25991631,27.71638870,-5.40718985,27.18382835,-11.48049831,-4.13848162,20.80560493,21.21320534,-4.86633825,24.46479797,-16.66710663,-4.86633682,24.46479797,16.66710281,-4.13847971,20.80560493,-21.21320343,-5.40718985,27.18382835,11.48050213,-3.25158072,16.34685898,-24.94409180,-5.74023724,28.85819435,5.85270882,-2.23972535,11.25991249,-27.71638680,-1.14179850,5.74026012,29.42355728,-1.14179790,5.74025249,-29.42355919,0.00001179,16.66711044,-24.94409180,0.00001201,21.21320724,-21.21320343,0.00001425,29.42355728,5.85270882,0.00001022,27.71639252,11.48050213,0.00001067,11.48050690,-27.71638680,0.00001022,30.00000381,0.00000358,0.00001089,11.48050880,27.71638870,0.00001033,5.85271788,29.42355728,0.00000944,5.85271120,-29.42355919,0.00001425,29.42355728,-5.85270500,0.00001089,16.66711426,24.94408607,0.00001022,27.71639252,-11.48049831,0.00001022,21.21320724,21.21320534,0.00001246,24.94408798,-16.66710663,0.00001425,24.94408798,16.66710281,4.86636257,24.46479416,-16.66710663,5.40721035,27.18382835,-11.48049831,4.86636448,24.46479416,16.66710281,4.13850212,20.80560303,21.21320534,4.13850355,20.80560303,-21.21320343,5.40721035,27.18382835,11.48050213,3.25160384,16.34685707,-24.94409180,5.74026585,28.85818863,5.85270882,2.23974657,11.25991058,-27.71638680,5.85272074,29.42356110,0.00000358,2.23974705,11.25991440,27.71638870,1.14181888,5.74025917,29.42355728,1.14181662,5.74025249,-29.42355919,5.74026585,28.85818863,-5.85270500,3.25160384,16.34685898,24.94408607,2.23974514,5.40719986,-29.42355919,4.39341021,10.60660362,-27.71638680,11.25992203,27.18381882,-5.85270500,11.48051453,27.71638680,0.00000358,6.37823963,15.39840508,24.94408607,4.39341116,10.60660553,27.71638870,10.60661411,25.60660553,-11.48049831,8.11795330,19.59844780,21.21320534,9.54570103,23.04533005,-16.66710663,9.54570293,23.04533005,16.66710281,8.11795425,19.59844780,-21.21320343,10.60661411,25.60660553,11.48050213,6.37823963,15.39840126,-24.94409180,11.25992203,27.18381882,5.85270882,2.23974848,5.40720558,29.42355728,9.25976276,13.85819435,-24.94409180,11.78543854,17.63813782,-21.21320343,16.34686470,24.46478844,5.85270882,15.39840889,23.04533386,11.48050213,6.37823772,9.54569054,-27.71638680,16.66711807,24.94408798,0.00000358,6.37823963,9.54569340,27.71638870,3.25160551,4.86635590,29.42355728,3.25160146,4.86635113,-29.42355919,16.34686470,24.46478844,-5.85270500,9.25976372,13.85819817,24.94408607,15.39840889,23.04533386,-11.48049831,11.78543854,17.63813782,21.21320534,13.85820389,20.74024582,-16.66710663,13.85820484,20.74024582,16.66710281,17.63814163,17.63813019,-16.66710663,19.59845543,19.59844780,-11.48049831,17.63814545,17.63812828,16.66710281,15.00001144,15.00000191,21.21320534,15.00001144,15.00000000,-21.21320343,19.59845543,19.59844780,11.48050213,11.78543854,11.78542328,-24.94409180,20.80560684,20.80559158,5.85270882,8.11795330,8.11794281,-27.71638680,21.21321487,21.21320343,0.00000358,8.11795616,8.11794376,27.71638870,4.13850594,4.13849545,29.42355728,4.13850117,4.13849115,-29.42355919,20.80560684,20.80559158,-5.85270500,11.78544044,11.78542900,24.94408607,4.86636066,3.25159168,-29.42355919,9.54570103,6.37822628,-27.71638680,24.46480179,16.34684753,-5.85270500,24.94409752,16.66710281,0.00000358,13.85820866,9.25974941,24.94408607,9.54570389,6.37822676,27.71638870,23.04534531,15.39840126,-11.48049831,17.63814735,11.78542519,21.21320534,20.74026108,13.85818958,-16.66710663,20.74025917,13.85818672,16.66710281,17.63814545,11.78542328,-21.21320343,23.04534531,15.39840126,11.48050213,13.85820580,9.25974751,-24.94409180,24.46480179,16.34684753,5.85270882,4.86636591,3.25159431,29.42355728,15.39840889,6.37822390,-24.94409180,19.59845352,8.11793995,-21.21320343,27.18382835,11.25990295,5.85270882,25.60661507,10.60660267,11.48050213,10.60661316,4.39339828,-27.71638680,27.71639252,11.48049927,0.00000358,10.60661507,4.39339828,27.71638870,5.40721416,2.23973656,29.42355728,5.40720892,2.23973536,-29.42355919,27.18382835,11.25990295,-5.85270500,15.39841461,6.37822628,24.94408607,25.60661507,10.60660267,-11.48049831,19.59845543,8.11794090,21.21320534,23.04533958,9.54568481,-16.66710663,23.04533768,9.54568291,16.66710281,20.80560875,4.13848925,21.21320534,16.34686661,3.25159049,24.94408607,24.46479988,4.86634684,-16.66710663,27.18383598,5.40719891,-11.48049831,24.46479797,4.86634541,16.66710281,20.80560684,4.13848877,-21.21320343,27.18383598,5.40719891,11.48050213,16.34686470,3.25158882,-24.94409180,28.85820007,5.74024677,5.85270882,11.25991917,2.23973489,-27.71638680,29.42356491,5.85270643,0.00000358,11.25992298,2.23973417,27.71638870,5.74026775,1.14180732,29.42355728,5.74026108,1.14180708,-29.42355919,28.85820007,5.74024677,-5.85270500,30.00000381,-0.00000313,0.00000358,29.42356300,-0.00000447,5.85270882,11.48051643,-0.00000156,27.71638870,5.85272551,-0.00000101,29.42355728,5.85271931,0.00000000,-29.42355919,11.48051453,-0.00000067,-27.71638680,29.42356300,-0.00000447,-5.85270500,16.66711998,-0.00000201,24.94408607,27.71639824,-0.00000134,-11.48049831,21.21321487,-0.00000179,21.21320534,24.94409370,-0.00000313,-16.66710663,24.94409180,-0.00000402,16.66710281,21.21321106,-0.00000179,-21.21320343,27.71639824,-0.00000134,11.48050213,16.66711617,-0.00000291,-24.94409180,20.80560684,-4.13849258,-21.21320343,24.46479797,-4.86635256,-16.66710663,27.18383408,-5.40720034,11.48050213,24.46479797,-4.86635303,16.66710281,16.34686279,-3.25159431,-24.94409180,28.85819626,-5.74025536,5.85270882,11.25991917,-2.23973608,-27.71638680,29.42356110,-5.85271168,0.00000358,11.25992203,-2.23973727,27.71638870,5.74026680,-1.14180923,29.42355728,5.74026108,-1.14180696,-29.42355919,28.85819626,-5.74025536,-5.85270500,16.34686661,-3.25159431,24.94408607,27.18383408,-5.40720034,-11.48049831,20.80560684,-4.13849306,21.21320534,25.60661125,-10.60660362,-11.48049831,27.18382645,-11.25991058,-5.85270500,19.59845352,-8.11794376,21.21320534,15.39840889,-6.37823009,24.94408607,23.04533386,-9.54569054,-16.66710663,23.04533386,-9.54569054,16.66710281,19.59844971,-8.11794376,-21.21320343,25.60661125,-10.60660362,11.48050213,15.39840698,-6.37822866,-24.94409180,27.18382645,-11.25991058,5.85270882,10.60661316,-4.39339924,-27.71638680,27.71638680,-11.48050308,0.00000358,10.60661411,-4.39340115,27.71638870,5.40721321,-2.23973846,29.42355728,5.40720844,-2.23973489,-29.42355919,9.54570007,-6.37822676,-27.71638680,13.85820007,-9.25975037,-24.94409180,24.94408798,-16.66710663,0.00000358,24.46479607,-16.34685516,5.85270882,9.54570103,-6.37822866,27.71638870,4.86636400,-3.25159550,29.42355728,4.86635971,-3.25159097,-29.42355919,24.46479607,-16.34685516,-5.85270500,13.85820389,-9.25975227,24.94408607,23.04534149,-15.39840126,-11.48049831,17.63814163,-11.78542614,21.21320534,20.74025345,-13.85819244,-16.66710663,20.74025154,-13.85819244,16.66710281,17.63813972,-11.78542614,-21.21320343,23.04534149,-15.39840126,11.48050213,13.85820007,-9.25975037,-24.94409180,15.00000763,-15.00000000,-21.21320343,17.63813782,-17.63813210,-16.66710663,19.59845352,-19.59844780,11.48050213,17.63813400,-17.63813210,16.66710281,11.78543091,-11.78542614,-24.94409180,20.80559731,-20.80559731,5.85270882,8.11795139,-8.11794281,-27.71638680,9.54570007,-6.37822676,-27.71638680,21.21320343,-21.21319962,0.00000358,8.11795235,-8.11794472,27.71638870,4.13850307,-4.13849545,29.42355728,4.13849926,-4.13849020,-29.42355919,4.86635971,-3.25159097,-29.42355919,20.80559731,-20.80559731,-5.85270500,11.78543472,-11.78542900,24.94408607,19.59845352,-19.59844780,-11.48049831,15.00000954,-15.00000000,21.21320534,15.39840698,-23.04533386,-11.48049831,16.34685326,-24.46479034,-5.85270500,11.78543186,-17.63813210,21.21320534,9.25975704,-13.85819626,24.94408607,13.85819626,-20.74024582,-16.66710663,13.85819530,-20.74024582,16.66710281,11.78543091,-17.63813210,-21.21320343,15.39840698,-23.04533386,11.48050213,9.25975609,-13.85819340,-24.94409180,16.34685326,-24.46479034,5.85270882,6.37823582,-9.54569054,-27.71638680,16.66710663,-24.94408035,0.00000358,6.37823582,-9.54569340,27.71638870,3.25160289,-4.86635494,29.42355728,3.25160027,-4.86634970,-29.42355919,4.39340830,-10.60660267,-27.71638680,6.37823200,-15.39839935,-24.94409180,11.48050404,-27.71637917,0.00000358,11.25990868,-27.18381882,5.85270882,4.39340734,-10.60660458,27.71638870,2.23974562,-5.40720367,29.42355728,2.23974419,-5.40719748,-29.42355919,11.25990868,-27.18381882,-5.85270500,6.37823343,-15.39840126,24.94408607,10.60660839,-25.60660362,-11.48049831,8.11795044,-19.59844398,21.21320534,9.54569435,-23.04532814,-16.66710663,9.54569244,-23.04532623,16.66710281,8.11794758,-19.59844398,-21.21320343,10.60660839,-25.60660362,11.48050213,4.13849735,-20.80559731,-21.21320343,4.86635590,-24.46478844,-16.66710663,5.40720463,-27.18382645,11.48050213,4.86635447,-24.46478653,16.66710281,3.25159764,-16.34685135,-24.94409180,5.74025345,-28.85818481,5.85270882,2.23974466,-11.25990868,-27.71638680,5.85271311,-29.42354965,0.00000358,2.23974323,-11.25991058,27.71638870,1.14181626,-5.74025631,29.42355728,1.14181614,-5.74025059,-29.42355919,5.74025345,-28.85818481,-5.85270500,3.25159836,-16.34685516,24.94408607,5.40720463,-27.18382645,-11.48049831,4.13849926,-20.80559731,21.21320534,0.00000687,-16.66710663,24.94408607,0.00000754,-11.48050499,27.71638870,0.00000530,-27.71638680,-11.48049831,0.00000307,-29.42354965,-5.85270500,0.00000843,-21.21320343,21.21320534,0.00000665,-24.94408035,-16.66710663,0.00000620,-24.94407845,16.66710281,0.00000665,-21.21320343,-21.21320343,0.00000530,-27.71638680,11.48050213,0.00000642,-16.66710281,-24.94409180,0.00000307,-29.42354965,5.85270882,0.00000933,-11.48050308,-27.71638680,0.00000486,-29.99998856,0.00000358,0.00000832,-5.85271358,29.42355728,0.00000944,-5.85270786,-29.42355919,-5.74024677,-28.85818100,5.85270882,-5.40719318,-27.18382263,11.48050213,-2.23972583,-11.25990868,-27.71638680,-3.25158405,-16.34685135,-24.94409180,-5.85270309,-29.42354202,0.00000358,-2.23972797,-11.25991058,27.71638870,-1.14179957,-5.74025536,29.42355728,-1.14179730,-5.74024963,-29.42355919,-5.74024677,-28.85818100,-5.85270500,-3.25158453,-16.34685326,24.94408607,-5.40719318,-27.18382263,-11.48049831,-4.13848162,-20.80559540,21.21320534,-4.86634207,-24.46478653,-16.66710663,-4.86634207,-24.46478271,16.66710281,-4.13848352,-20.80559540,-21.21320343,-9.54567909,-23.04532242,-16.66710663,-10.60659599,-25.60660172,-11.48049831,-9.54567909,-23.04532051,16.66710281,-8.11793232,-19.59844208,21.21320534,-8.11793327,-19.59844017,-21.21320343,-10.60659599,-25.60660172,11.48050213,-6.37821770,-15.39839363,-24.94409180,-11.25990009,-27.18380928,5.85270882,-4.39338923,-10.60660267,-27.71638680,-11.48049355,-27.71636963,0.00000358,-4.39339113,-10.60660362,27.71638870,-2.23972821,-5.40720177,29.42355728,-2.23972464,-5.40719604,-29.42355919,-11.25990009,-27.18380928,-5.85270500,-6.37821913,-15.39839745,24.94408607,-3.25158024,-4.86634779,-29.42355919,-6.37821674,-9.54568958,-27.71638680,-16.34684372,-24.46478081,-5.85270500,-16.66709518,-24.94406891,0.00000358,-9.25974083,-13.85819054,24.94408607,-6.37821913,-9.54569054,27.71638870,-15.39839363,-23.04533005,-11.48049831,-11.78541374,-17.63813210,21.21320534,-13.85818005,-20.74024200,-16.66710663,-13.85817909,-20.74024010,16.66710281,-11.78541660,-17.63813019,-21.21320343,-15.39839363,-23.04533005,11.48050213,-9.25973892,-13.85818672,-24.94409180,-16.34684372,-24.46478081,5.85270882,-3.25158477,-4.86635256,29.42355728,-11.78541374,-11.78541756,-24.94409180,-14.99999046,-14.99999523,-21.21320343,-20.80558395,-20.80558395,5.85270882,-19.59843826,-19.59844208,11.48050213,-8.11793232,-8.11794090,-27.71638680,-21.21318817,-21.21318626,0.00000358,-8.11793423,-8.11794186,27.71638870,-4.13848448,-4.13849211,29.42355728,-4.13847923,-4.13848829,-29.42355919,-20.80558395,-20.80558395,-5.85270500,-11.78541660,-11.78542137,24.94408607,-19.59843826,-19.59844208,-11.48049831,-14.99999046,-14.99999809,21.21320534,-17.63811874,-17.63812447,-16.66710663,-17.63811874,-17.63812256,16.66710281,-20.74023438,-13.85818481,-16.66710663,-23.04532623,-15.39839554,-11.48049831,-20.74023438,-13.85818291,16.66710281,-17.63812447,-11.78542233,21.21320534,-17.63812447,-11.78541946,-21.21320343,-23.04532623,-15.39839554,11.48050213,-13.85818291,-9.25974178,-24.94409180,-24.46477699,-16.34683990,5.85270882,-9.54568005,-6.37822533,-27.71638680,-24.94406700,-16.66708946,0.00000358,-9.54568291,-6.37822580,27.71638870,-4.86634350,-3.25159192,29.42355728,-4.86633825,-3.25158954,-29.42355919,-24.46477699,-16.34683990,-5.85270500,-13.85818386,-9.25974560,24.94408607,-5.40718555,-2.23973346,-29.42355919,-10.60659313,-4.39339733,-27.71638680,-27.18380356,-11.25989723,-5.85270500,-27.71636200,-11.48048782,0.00000358,-15.39838982,-6.37822247,24.94408607,-10.60659409,-4.39339733,27.71638870,-25.60659409,-10.60659599,-11.48049831,-19.59843445,-8.11793995,21.21320534,-23.04531288,-9.54568100,-16.66710663,-23.04531288,-9.54568005,16.66710281,-19.59843445,-8.11793613,-21.21320343,-25.60659409,-10.60659599,11.48050213,-15.39838696,-6.37821913,-24.94409180,-27.18380356,-11.25989723,5.85270882,-5.40719223,-2.23973489,29.42355728,-16.34683800,-3.25158548,-24.94409180,-20.80558586,-4.13848591,-21.21320343,-28.85816956,-5.74024248,5.85270882,-27.18381500,-5.40719318,11.48050213,-11.25989914,-2.23973393,-27.71638680,-29.42353058,-5.85269690,0.00000358,-11.25990105,-2.23973370,27.71638870,-5.74024439,-1.14180589,29.42355728,-5.74023771,-1.14180613,-29.42355919,-28.85816956,-5.74024248,-5.85270500,-16.34684372,-3.25158787,24.94408607,-27.18381500,-5.40719318,-11.48049831,-20.80558777,-4.13848925,21.21320534,-24.46477509,-4.86634493,-16.66710663,-24.46477509,-4.86634302,16.66710281,0.00000603,-0.00000903,30.00000000,-5.85270309,0.00000000,-29.42355919,0.00000978,0.00000000,-30.00000000,4.13849926,-4.13849020,-29.42355919,3.25160027,-4.86634970,-29.42355919,2.23974419,-5.40719748,-29.42355919,1.14181614,-5.74025059,-29.42355919,0.00000944,-5.85270786,-29.42355919,-1.14179730,-5.74024963,-29.42355919,-2.23972464,-5.40719604,-29.42355919,-3.25158024,-4.86634779,-29.42355919,-4.13847923,-4.13848829,-29.42355919,-4.86633825,-3.25158954,-29.42355919,-5.40718555,-2.23973346,-29.42355919,-5.74023771,-1.14180613,-29.42355919};
unsigned int bufPosLen = sizeof(posElems) / sizeof(posElems[0]);
unsigned int compCount = 3;
unsigned int elemCount = bufPosLen / compCount;
csRef bufPos = csRenderBuffer::CreateRenderBuffer;
}
//factory wrapper
csRef wrap = psengine->GetEngine()->CreateMeshFactory(fact, “moonfact”);
if (wrap == 0)
Err::FatalError(“EuLOADER: failed to create factory wrapper!\n”);
return wrap;
}
Creating the terrain was quite a pain and it’s quite a long adventure so perhaps of some use to see the code for it too:
Putting some of the above together, there’s a more useful GetMesh that takes a numeric id (hence, a Euloran proper id since all objects in Eulora have a numeric id) and either finds or creates the thing (according to what EuCore says that thing should be):
For some really tedious stuff, here’s the creation of Foxy herself, hence a Cal3D object:
Finally, the sector itself with lights and then various tests, some still in, some commented out (although the working code is still there otherwise):
There is of course more to the prototoype/test code and otherwise changes and excisions to legacy code but comments are helpfully in place everywhere and so I don’t feel the need to repeat them here. Despite those added comments and despite the fact that a lot of now-unused code was commented out rather than deleted at this stage, this prototype client is still thousands LOC shorter than the legacy client so there’s some satisfaction to it all at least, that’s the most I can say on it currently. Feel free to ask your questions in the comments box below, as usual.