2 registered members (Akow, tomaslolo),
1,536
guests, and 12
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: C# wrapper 2.3.3 - RELEASE
[Re: jenGs]
#386888
11/10/11 14:25
11/10/11 14:25
|
Joined: Dec 2002
Posts: 616 Austria
Stromausfall
OP
User
|
OP
User
Joined: Dec 2002
Posts: 616
Austria
|
hmm i can't seem to reproduce that behaviour... can you tell me more about the instance where this problem occured or maybe even send me a small demo project where the problem occurs ?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AcknexWrapper;
namespace Test
{
class Program
{
//the main method, called by the scheduler
private static IEnumerable<ScheduleMethod> myMainMethod()
{
EngFun.level_load(null);
yield return 1;
ENTITY terrain =
ENTITY.ent_createterrain(null, new Vector(100, 0, -5), 10, 10, 5);
// wait a frame, before changing the terrain !
yield return 1;
CONTACT c =
terrain.ent_getvertex(null, 7);
c.z += 10; // increase the vertex height
c.v = null; // c.x,y,z was changed, instead of c.v
terrain.ent_setvertex(c, 7); // update the mesh
terrain.ent_fixnormals(0);
}
static void Main(string[] args)
{
//open the engine
EngFun.engine_open(null, null);
//start the scheduler
Scheduler.StartScheduler(myMainMethod);
}
}
}
|
|
|
Re: C# wrapper 2.3.3 - RELEASE
[Re: Stromausfall]
#387447
11/18/11 19:02
11/18/11 19:02
|
Joined: Jul 2010
Posts: 283 Germany
jenGs
Member
|
Member
Joined: Jul 2010
Posts: 283
Germany
|
Hi, Sorry for my long response time. Here is a demo Project. It is a vs2010 sollution in debug build mode. demo If you press f1 the terrain is morphed randomly, if you press f3 the mdl is morphed. On f2 you can call fixnormals for the terrain, on f4 you can call fixnormals for the mdl. Thank you for taking the time to look onto this.
|
|
|
Re: C# wrapper 2.3.3 - RELEASE
[Re: jenGs]
#387536
11/20/11 11:54
11/20/11 11:54
|
Joined: Dec 2002
Posts: 616 Austria
Stromausfall
OP
User
|
OP
User
Joined: Dec 2002
Posts: 616
Austria
|
Hi ! i finally found some time to look at the example ! This is indeed a strange bug ! I tried to convert the code from the example to lite-c - there the problem happens too (at least for me!) ! It seems to me that this problem is not isolated to the C# wrapper ! I tried several other things, but it somehow seems that ent_fixnormals always resets to the original state of the terrain ... Does the problem also occur for you in lite-c with this code ? : (edited) : I just discovered that the code i previously posted, in which I said that i can't reproduce the error, now also produces this error ! I guess this is because i used 8.20.1 when i wasn't able to reproduce the error but now after updating to 8.30.5, the error is always produced.... THUS i think the error somehow smuggled itself into existence between A8.20.1 and A8.30.5 ! That's why I guess this is a engine bug, caused by the new Acknex version !
// we can't use default.c because there f1 - f4 are already preset with some other stuff !
#include <acknex.h>
ENTITY *demoTerrain;
ENTITY *demoModel;
void MorphTerrain()
{
int i;
for (i = 0; i < ent_status(demoTerrain, 0); i++)
{
CONTACT *c = ent_getvertex(demoTerrain, NULL, i);
c.z += random(10);
c.v = NULL;
ent_setvertex(demoTerrain, c, i);
}
}
void MorphModel()
{
int i;
for (i = 0; i < ent_status(demoModel, 0); i++)
{
CONTACT *c = ent_getvertex(demoModel, NULL, i);
c.z += random(10);
c.v = NULL;
ent_setvertex(demoModel, c, i);
}
}
void FixNormalsTerrain()
{
ent_fixnormals(demoTerrain, 0);
}
void FixNormalsModel()
{
ent_fixnormals(demoModel, 0);
}
void SetUpDemo()
{
camera.x = -1676;
camera.y = 432;
camera.z = 1126;
camera.pan = 0;
camera.tilt = -35;
BMAP *grey = bmap_createblack(512, 512, 24);
bmap_fill(grey, vector(128,128,128), 100);
demoTerrain = ent_createterrain(grey, vector(0,0,0), 16, 16, 64);
demoModel = ent_create("plane.mdl", vector(0, 1040, 0), NULL);
}
int main()
{
mouse_mode = 4;
mouse_pointer = 2;
mouse_sync = 1;
video_switch(10, 32, 2);
wait(1);
level_load(NULL);
sun_light = 100;
sun_pos.x = 80;
sun_pos.y = 154;
sun_pos.z = 0;
SetUpDemo();
on_f1 = MorphTerrain;
on_f2 = FixNormalsTerrain;
on_f3 = MorphModel;
on_f4 = FixNormalsModel;
}
P.S.: @Dark_samurai : Thank you
Last edited by Stromausfall; 11/20/11 12:08.
|
|
|
Re: C# wrapper 2.3.3 - RELEASE
[Re: Stromausfall]
#387562
11/20/11 17:57
11/20/11 17:57
|
Joined: Jul 2010
Posts: 283 Germany
jenGs
Member
|
Member
Joined: Jul 2010
Posts: 283
Germany
|
Hi, Thank you for looking Now I get the problem too. Figured out that my Laptop had an old Acknex version. I tested the Lite-C version with it and the c# version with my desktop PC which is up to date in Acknex matters. So this seems to be a bug-Forum case. I will open a topic there when I have some time today. MfG, Patrick
|
|
|
Re: C# wrapper 2.3.3 - RELEASE
[Re: jenGs]
#390738
01/04/12 12:18
01/04/12 12:18
|
Joined: Nov 2007
Posts: 2,568 Germany, BW, Stuttgart
MasterQ32
Expert
|
Expert
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
|
hey stromausfall! i'm asking another time: could you please change some things in your wrapper? you simply copied all acknex functions to lite-c, but your wrapper could be much more powerful. Atm i'm changing a lot of stuff to have faster results. so some suggestions what to change: - Allow users to set vectors per =, not only per vec_set. Some possible solution:
public Color blueGreenRed
{
get
{
return Color.createFromPointer(bluePointer);
}
set
{
Color.createFromPointer(bluePointer).vec_set(value);
}
}
- Please add constructors to your classe. Eg:
new ENTITY("mymodel.mdl", new Vector(1,2,3), new EventIntPtr(pla));
new PANEL("pos_x = 5; pos_y =10; flags = SHOW;",6);
...
- Add a implicit cast to the Vector class, so we can write this:
double x = myent.xyz;
myent.xyz = 4;
This looks a little weird, but you can now also simply remove this xyz-vector and name it x. This results in the simple gamestudio style:
myent.x = new Vector(1,2,3);
double x = myent.x;
myent.x = 4;
Vector k = myent.x;
- Add a Tag property to all objects (like in WinForms), so we can store custom objects into the engine objects
- Also you could split the class ENTITY into ViewEntity and WorldEntity, so we can differ also in code and it will be much clearer what is used.
- another thing what would be nice: remove all prefixes of the class functions. this looks simply strange. much better would be this:
Entity myEnt = new Entity("lalala.mdl",new Vector(4,5,6),null);
myEnt.animate("walk",50,AnimationMode.None);
myEnt.remove();
- Also if you change the constructor thing, you can add this constructor to Entity:
public Entity(string modelFile, Vector position)
Because sometimes we don't need an entity event or we manage those things ourselves, so we don't need this parameter.
Would be really cool if we could see some of my suggestions in the next version of the wrapper! Greetz Felix A little bit offtopic:If someone needs some cool libraries c# (network and multitouch, both useable with gs): http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=390042#Post390042
|
|
|
Re: C# wrapper 2.3.3 - RELEASE
[Re: MasterQ32]
#390925
01/05/12 22:55
01/05/12 22:55
|
Joined: Dec 2002
Posts: 616 Austria
Stromausfall
OP
User
|
OP
User
Joined: Dec 2002
Posts: 616
Austria
|
hi ! >>Allow users to set vectors per =, not only per vec_set. Some possible solution: I don't think that that's an optimal solution, as it suggests that the Vector object is actually assigned, which would mean that
Vector temp = new Vector(2, 3, 4);
entity.xyz = temp;
temp.x = 2000;
// I would expect entity.x now to be 2000 ! but it wouldn't be that way !
>>Please add constructors to your classe. Eg: i already once used constructors for this, but static methods are preferable for me, as with static constructors it's immediately clear which method is used to construct the object, with a normal constructor, one has to read, guess or search (because only the number/types of arguments would change for the constructors)! >>Add a implicit cast to the Vector class, so we can write this: looks too weird imho >>Add a Tag property to all objects (like in WinForms), so we can store custom objects into the engine objects i currently don't know what Tags are for, I had a quick look and only found something about an object variable ? In which situations is such a tag used or beneficial ? >>Also you could split the class ENTITY into ViewEntity and WorldEntity, so we can differ also in code and it will be much clearer what is used. this is a good idea, although I'll have to see if this is actually doable (because i don't know if viewEntities and worldEntities are handled that separate) >>another thing what would be nice: remove all prefixes of the class functions. this looks simply strange. much better would be this: this has been mentioned multiple times in this thread, and yes it would look much better, but i want to know exactly what method I'm calling and be able to look it up immediately in the gamestudio manual, that's why i think that the actual name of the lite-c method is preferable Thanks for the feedback
|
|
|
|