All pastes #458658 Raw Edit

effects loader

public text v1 · immutable
#458658 ·published 2007-04-26 00:14 UTC
rendered paste body
                                        std::string path;

					nvutil::GetCurrentDir( path );

					//00000	PTERM 000000
					std::string shadeff;

					//shadeff += "//effects//car_paint_hdr.fx";
					//shadeff += "//effects//Flame.fx";				/// Flame working
					//shadeff += "//effects//post_holga.fx";
					//shadeff += "//effects//post_moscowTV.fx";
					shadeff += "//effects//warpedge.fx";

					path += shadeff;

					RCObject_AutoPtr< CgFxHandle > hCgfx( CreateHandle( CgFxHandle ) );

					///// Shader Test
					bool effectValid = false;

					WritableObject< CgFx > cgfx_m( hCgfx.get() );
					WritableObject< CgFxEffect > effect( cgfx_m->getEffect() );
						//nvsg::CgFx::cg

					std::string err;
					if( !effect->createFromFile(path, err) )
						{
						printf("Shader Error: %s\n", err.c_str() );
						}
					else
						{
						printf("Shader Loaded :: %s\n", shadeff.c_str());
						effectValid = true;
						}

					pStateSet->addAttribute( hCgfx.get() );