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 !

Code:
// 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 laugh

Last edited by Stromausfall; 11/20/11 12:08.

get the C# wrapper:
for A7.85.4 and A8.30.4, Version 2.3.9
at http://acknexwrapper2.matthias-auer.net/ or visit the thread