shade-c terrain

Posted By: Fab4

shade-c terrain - 09/24/09 09:00

hi guys,
ive got a strange problem...
im trying to use the shade-c terrain shader but it doesnt work...
thats how its in the manual:

How to use:
Set my.material = sc_mtl_obj_terrain;
Set sc_mtl_obj_terrain.skin1 to your colortilemap, or simply create a custom material


Code:
BMAP* myTerrainColor = "myTerrainTile.bmp";

MATERIAL* mtl_myTerrain ()
{
   skin1 = myTerrainColor;
   effect = "sc_obj_terrain.fx";
}




and thats my complete code (i used the entities from the demo for trying)

Code:
#define PRAGMA_PATH "shade-c"
#define PRAGMA_PATH "stuff"
#include <acknex.h>
#include <default.c>
#include "sc_core.c"; 

ENTITY* ent_terrain;


BMAP* myTerrainColor = "terrain_color.dds";

MATERIAL* mtl_myTerrain ()
{
   skin1 = myTerrainColor;
   effect = "sc_obj_terrain.fx";
}


void main()
{
   level_load("empty.wmb");
   wait(4);
	ent_terrain = ent_create("terrain.mdl",vector(0,0,0),mtl_myTerrain);
	wait(2);
   //set resolution
   video_switch(8,32,0); 

   //Setup Shade-C
   sc_setup();
   //

   //you can now make full use of Shade-C!
   
   
}



i always get a syntax error in line 14 'skin1' undeclared identifier

by changing
Code:
MATERIAL* mtl_myTerrain ()
{
   skin1 = myTerrainColor;
   effect = "sc_obj_terrain.fx";
}


to
Code:
MATERIAL* mtl_myTerrain =
{
   skin1 = myTerrainColor;
   effect = "sc_obj_terrain.fx";
}


the error disappers but the engine crashs in by error E1513.

i realy dont know what to do, and i would by happy about every help i can get.



[edit]
ok i did it after hours of trying. grin

first i had to create the terrain model without shader and change the material later.
Code:
ent_terrain = ent_create("terrain2.mdl",vector(0,0,0),NULL);
	wait(2);
	ent_terrain.material = sc_mtl_obj_terrain;



for changing the tile set you have to
Code:
sc_bmap_terrainColor = bmap_create("new_tile.dds");
	wait(2);
	sc_mtl_obj_terrain.skin1=sc_bmap_terrainColor;



if i said something wrong, please feel free to spit on me grin
but it worked this way in my script
Posted By: JibbSmart

Re: shade-c terrain - 09/24/09 10:37

I think this:
Code:
MATERIAL* mtl_myTerrain ()


should be this:
Code:
MATERIAL* mtl_myTerrain () =



Jibb
Posted By: Fab4

Re: shade-c terrain - 09/24/09 12:26

thx first,
but in the the sc_objShaders.h its without only = ,too
but it works now

thx again
Posted By: JibbSmart

Re: shade-c terrain - 09/24/09 12:31

I haven't looked at Shade-C, but since you're talking about a ".h" file I think it's just a prototype, so that anything can use it no matter where it's placed in the code.

Glad it worked laugh

Jibb
Posted By: Enduriel

Re: shade-c terrain - 09/24/09 15:48

You assigned a material instead of an action on the ent_create's last parameter, that's why it crashed I think.
Posted By: Fab4

Re: shade-c terrain - 09/25/09 17:56

Originally Posted By: Enduriel
You assigned a material instead of an action on the ent_create's last parameter, that's why it crashed I think.

yes your right, how stupid :S
thx, i was really wondering why it didnt work...
© 2024 lite-C Forums