STATE_object_create_effect

 

 


#define EFFECT_DISABLE 1
#define EFFECT_DYNAMIC_ENVIRONMENT_MAPPING 2   When using this effect don't forget to call STATE_object_render_into_environment_map()
#define EFFECT_FAST_ENVIRONMENT_MAPPING 3   when using this effect don't forget to load a cubic texture and call STATE_object_set_bitmap()
#define EFFECT_CLOUD_COVER 4
#define EFFECT_SKYSPHERE 5
#define EFFECT_BUMPWAVES 6
#define EFFECT_WATER 7

   *** a very important function
   Cause the given object to be rendered according to the given effect script. This function is used to create all 
   the new effects such as water, reflection etc. Using this function one can utilize many of the available free
   Shaders and effects found on the Internet. This function also support Microsoft HLSL (High Level Shader Language)
   Another nice feature of this function is that you can modify the script used and thus create different effects.
   If you are very knowlegable in 3D graphics and math you can also try and write your own shader though for most users
   the best policy would be to use one of the available free shaders / effect files. 
   Even if you understand nothing of the Shader script, you can still try and modify some of the code, who knows
   many of the best inventions were discovered accedently ( Serendipity ).
  
   Parameters:
  		object_handle:
  			The object which should use the given effect script
  
  		effect_file:
  			The effect script file. This file could be one of the following:
  			1) *.vsh	- a vertex shader script in assembly language
  			2) *.fx		- an effect file written using Microsoft High Level Shader Language
  			3) *.vso	- An object code of a compiled shader. Note that object code shaders can not be
  						  edited in a text editor. To edit the shader you will need it's assembly source
  						  and then use a compiler such as NVidia Cg compiler (free for downloading from NVidia website)
  						  to compile the shader
  
  		pixel_shader_file:
  			A pixel shader script or NULL if a pixel shader is not in use
  			
  		effect_type:
  			Should be one of the constant above. Note that this constant should match the effect file used.
  			If you are trying an effect file that has no effect_type constant to match with then try all of
  			the constant till you get the effect working.
  
   Example A:
  		  Render the object using an dynamically generated environment mapping effect
  		  Note that using this specific effect would also required calling later STATE_object_render_into_environment_map(teapot, effect);
  		DWORD effect=STATE_object_create_effect(teapot, "..\\Effects\\dyn_env_map.fx", NULL,EFFECT_DYNAMIC_ENVIRONMENT_MAPPING);
  
   Example B:
  		  Disable effect for the specific object and get back to render the object using its polygon textures
  		STATE_object_create_effect(teapot, NULL, NULL,EFFECT_DISABLE);
  

 

 

Go to page 1      Select API

 

Copyright © 2007 3DSTATE Corporation. www.3dstate.com