예제 #1
0
void ei_dof_unittest()
{
    char	cur_dir[ EI_MAX_FILE_NAME_LEN ];
    char	output_filename[ EI_MAX_FILE_NAME_LEN ];

    ei_get_current_directory(cur_dir);

    ei_context(ei_create_context());

    ei_verbose(EI_VERBOSE_ALL);
    ei_link("eiIMG");
    ei_link("eiSHADER");

    ei_options("opt");
    ei_samples(0, 2);
    ei_contrast(0.05f, 0.05f, 0.05f, 0.05f);
    ei_filter(EI_FILTER_GAUSSIAN, 3.0f);
    ei_end_options();

    ei_shader("dof_shader");
    ei_shader_param_string("desc", "simple_dof");
    ei_shader_param_scalar("fplane", 0.1f);
    ei_end_shader();

    ei_camera("cam1");
    ei_append_filename(output_filename, cur_dir, "frame_dof01.bmp");
    ei_output(output_filename, "bmp", EI_IMG_DATA_RGB);
    ei_output_variable("color", EI_DATA_TYPE_VECTOR);
    ei_end_output();
    ei_focal(100.0f);
    ei_aperture(144.724029f);
    ei_aspect(800.0f / 600.0f);
    ei_resolution(800, 600);
    ei_clip(0.1,1000);
    ei_add_lens("dof_shader");
    ei_end_camera();

    ei_instance("caminst1");
    ei_element("cam1");
    ei_end_instance();

    ei_shader("point_light_shader");
    ei_shader_param_string("desc", "pointlight");
    ei_shader_param_scalar("intensity", 1.0f);
    ei_shader_param_vector("lightcolor", 1.0f, 1.0f, 1.0f);
    ei_end_shader();

    ei_light("light1");
    ei_add_light("point_light_shader");
    ei_origin(141.375732f, 83.116005f, 35.619434f);
    ei_end_light();

    ei_instance("lightinst1");
    ei_element("light1");
    ei_end_instance();

    ei_shader("phong_shader");
    ei_shader_param_string("desc", "plastic");
    ei_shader_param_vector("Cs", 1.0f, 0.2f, 0.3f);
    ei_shader_param_vector("Kd", 0.7f, 1.0f, 1.0f);
    ei_shader_param_scalar("Ks", 1.0f);
    ei_shader_param_scalar("roughness", 0.2f);
    ei_end_shader();

    ei_shader("opaque_shadow");
    ei_shader_param_string("desc", "opaque");
    ei_end_shader();

    ei_material("mtl");
    ei_add_surface("phong_shader");
    ei_add_shadow("opaque_shadow");
    ei_end_material();

    ei_object("obj1", "poly");
    ei_pos_list(ei_tab(EI_DATA_TYPE_VECTOR, 1024));
    ei_tab_add_vector(-7.068787f, -4.155799f, -22.885710f);
    ei_tab_add_vector(-0.179573f, -7.973234f, -16.724060f);
    ei_tab_add_vector(-7.068787f, 4.344949f, -17.619093f);
    ei_tab_add_vector(-0.179573f, 0.527515f, -11.457443f);
    ei_tab_add_vector(0.179573f, -0.527514f, -28.742058f);
    ei_tab_add_vector(7.068787f, -4.344948f, -22.580408f);
    ei_tab_add_vector(0.179573f, 7.973235f, -23.475441f);
    ei_tab_add_vector(7.068787f, 4.155800f, -17.313791f);
    ei_end_tab();
    ei_triangle_list(ei_tab(EI_DATA_TYPE_INDEX, 1024));
    ei_tab_add_index(0);
    ei_tab_add_index(1);
    ei_tab_add_index(3);
    ei_tab_add_index(0);
    ei_tab_add_index(3);
    ei_tab_add_index(2);
    ei_tab_add_index(1);
    ei_tab_add_index(5);
    ei_tab_add_index(7);
    ei_tab_add_index(1);
    ei_tab_add_index(7);
    ei_tab_add_index(3);
    ei_tab_add_index(5);
    ei_tab_add_index(4);
    ei_tab_add_index(6);
    ei_tab_add_index(5);
    ei_tab_add_index(6);
    ei_tab_add_index(7);
    ei_tab_add_index(4);
    ei_tab_add_index(0);
    ei_tab_add_index(2);
    ei_tab_add_index(4);
    ei_tab_add_index(2);
    ei_tab_add_index(6);
    ei_tab_add_index(4);
    ei_tab_add_index(5);
    ei_tab_add_index(1);
    ei_tab_add_index(4);
    ei_tab_add_index(1);
    ei_tab_add_index(0);
    ei_tab_add_index(2);
    ei_tab_add_index(3);
    ei_tab_add_index(7);
    ei_tab_add_index(2);
    ei_tab_add_index(7);
    ei_tab_add_index(6);
    ei_end_tab();
    ei_end_object();

    ei_instance("inst1");
    ei_add_material("mtl");
    ei_element("obj1");
    ei_end_instance();

    ei_instgroup("world");
    ei_add_instance("caminst1");
    ei_add_instance("lightinst1");
    ei_add_instance("inst1");
    ei_end_instgroup();

    // render frame 01
    ei_render("world", "caminst1", "opt");

    ei_delete_context(ei_context(NULL));
}
예제 #2
0
int main(int argc, char* argv[])
{
	ei_context();								// create rendering context

	ei_verbose("info");							// set verbosity level to info

	ei_link("liber_shader");					// link to standard C++ shader DSO

	ei_node("options", "opt");					// create a rendering options node
		ei_param_int("min_samples", 0);
		ei_param_int("max_samples", 16);
		ei_param_enum("filter", "gaussian");
		ei_param_scalar("filter_size", 3.0f);
		ei_param_scalar("display_gamma", 2.2f);	// by default, the display gamma is off
	ei_end_node();

	ei_node("outvar", "var1");
		ei_param_token("name", "color");
		ei_param_enum("type", "color");
		ei_param_bool("use_gamma", EI_TRUE);	// apply display gamma for this output
	ei_end_node();

	ei_node("output", "out1");					// create an output in PNG foramt
		ei_param_token("filename", "D:/box_scene.0001.png");
		ei_param_enum("data_type", "rgb");
		ei_param_array("var_list", ei_tab(EI_TYPE_TAG_NODE, 1));
			ei_tab_add_node("var1");
		ei_end_tab();
	ei_end_node();

	ei_node("camera", "cam1");					// create perspective camera
		ei_param_array("output_list", ei_tab(EI_TYPE_TAG_NODE, 1));
			ei_tab_add_node("out1");
		ei_end_tab();
		ei_param_scalar("focal", 100.0f);
		ei_param_scalar("aperture", 144.724029f);
		ei_param_scalar("aspect", 1.333333f);
		ei_param_int("res_x", 320);
		ei_param_int("res_y", 240);
	ei_end_node();

	ei_node("instance", "caminst1");			// create camera instance
		ei_param_node("element", "cam1");
	ei_end_node();

	ei_node("pointlight", "light1");			// create a point light
		ei_param_scalar("intensity", 100000.0f);
		ei_param_color("color", 1.0f, 1.0f, 1.0f);
	ei_end_node();

	ei_node("instance", "lightinst1");			// create light instance
		ei_param_node("element", "light1");
		ei_param_matrix("transform", 
			1.0f, 0.0f, 0.0f, 0.0f, 
			0.0f, 1.0f, 0.0f, 0.0f, 
			0.0f, 0.0f, 1.0f, 0.0f, 
			141.375732f, 83.116005f, 35.619434f, 1.0f);
		// motion transform must be set even when there's no motion blur
		ei_param_matrix("motion_transform", 
			1.0f, 0.0f, 0.0f, 0.0f, 
			0.0f, 1.0f, 0.0f, 0.0f, 
			0.0f, 0.0f, 1.0f, 0.0f, 
			141.375732f, 83.116005f, 35.619434f, 1.0f);
	ei_end_node();

	ei_node("plastic", "plastic_shader");		// create plastic surface shader
		ei_param_color("diffuse_color", 0.7f, 0.2f, 0.3f);
		ei_param_scalar("specular_weight", 0.8f);
		ei_param_scalar("specular_roughness", 0.1f);
	ei_end_node();

	ei_node("osl_shadergroup", "plastic_shader_group");
		ei_param_array("nodes", ei_tab(EI_TYPE_TAG_NODE, 1));
			ei_tab_add_node("plastic_shader");
		ei_end_tab();
	ei_end_node();

	ei_node("material", "mtl");
		ei_param_node("surface_shader", "plastic_shader_group");
	ei_end_node();

	ei_node("poly", "obj1");					// create triangle mesh
		ei_param_array("pos_list", ei_tab(EI_TYPE_POINT, 1));
			ei_tab_add_point(-7.068787f, -4.155799f, -22.885710f);
			ei_tab_add_point(-0.179573f, -7.973234f, -16.724060f);
			ei_tab_add_point(-7.068787f,  4.344949f, -17.619093f);
			ei_tab_add_point(-0.179573f,  0.527515f, -11.457443f);
			ei_tab_add_point(0.179573f, -0.527514f, -28.742058f);
			ei_tab_add_point(7.068787f, -4.344948f, -22.580408f);
			ei_tab_add_point(0.179573f,  7.973235f, -23.475441f);
			ei_tab_add_point(7.068787f,  4.155800f, -17.313791f);
		ei_end_tab();
		ei_param_array("face_counts", ei_tab(EI_TYPE_INDEX, 1));
			ei_tab_add_index(4);				// all faces are of 4 vertices
			ei_tab_add_index(4);
			ei_tab_add_index(4);
			ei_tab_add_index(4);
			ei_tab_add_index(4);
			ei_tab_add_index(4);
		ei_end_tab();
		ei_param_array("face_indices", ei_tab(EI_TYPE_INDEX, 1));
			ei_tab_add_index(0); ei_tab_add_index(1); ei_tab_add_index(3); ei_tab_add_index(2);
			ei_tab_add_index(1); ei_tab_add_index(5); ei_tab_add_index(7); ei_tab_add_index(3);
			ei_tab_add_index(5); ei_tab_add_index(4); ei_tab_add_index(6); ei_tab_add_index(7);
			ei_tab_add_index(4); ei_tab_add_index(0); ei_tab_add_index(2); ei_tab_add_index(6);
			ei_tab_add_index(4); ei_tab_add_index(5); ei_tab_add_index(1); ei_tab_add_index(0);
			ei_tab_add_index(2); ei_tab_add_index(3); ei_tab_add_index(7); ei_tab_add_index(6);
		ei_end_tab();
		ei_declare_color_array("geom_color", EI_FACEVARYING, EI_NULL_TAG);	// declare array of data elements
		ei_param_array("geom_color", ei_tab(EI_TYPE_COLOR, 1));				// set the data values
			ei_tab_add_color(0.0f, 1.0f, 1.0f);
			ei_tab_add_color(1.0f, 0.0f, 1.0f);
			ei_tab_add_color(1.0f, 1.0f, 0.0f);
			ei_tab_add_color(1.0f, 0.0f, 0.0f);
			ei_tab_add_color(0.0f, 1.0f, 0.0f);
			ei_tab_add_color(0.0f, 0.0f, 1.0f);
			ei_tab_add_color(1.0f, 1.0f, 1.0f);
			ei_tab_add_color(0.5f, 1.0f, 0.5f);
			ei_tab_add_color(1.0f, 0.5f, 0.5f);
			ei_tab_add_color(0.5f, 0.5f, 1.0f);
			ei_tab_add_color(1.0f, 0.0f, 0.5f);
			ei_tab_add_color(0.5f, 1.0f, 0.0f);
			ei_tab_add_color(0.0f, 1.0f, 0.5f);
			ei_tab_add_color(0.5f, 0.0f, 1.0f);
			ei_tab_add_color(1.0f, 0.5f, 0.0f);
			ei_tab_add_color(0.0f, 0.5f, 1.0f);
			ei_tab_add_color(0.3f, 0.8f, 1.0f);
			ei_tab_add_color(1.0f, 0.5f, 0.7f);
			ei_tab_add_color(0.2f, 1.0f, 0.6f);
			ei_tab_add_color(1.0f, 0.2f, 0.9f);
			ei_tab_add_color(0.4f, 0.7f, 1.0f);
			ei_tab_add_color(1.0f, 0.3f, 0.3f);
			ei_tab_add_color(0.8f, 0.6f, 0.2f);
			ei_tab_add_color(0.1f, 0.9f, 1.0f);
		ei_end_tab();
		ei_declare_index_array("geom_color_idx", EI_FACEVARYING, EI_NULL_TAG);						// declare array of indices
		ei_param_array("geom_color_idx", ei_tab(EI_TYPE_INDEX, 1));									// set the indices
			ei_tab_add_index(0); ei_tab_add_index(3); ei_tab_add_index(9); ei_tab_add_index(6);		// the number of data elements must 
			ei_tab_add_index(7); ei_tab_add_index(10); ei_tab_add_index(15); ei_tab_add_index(12);	// match the sum of all face counts
			ei_tab_add_index(13); ei_tab_add_index(16); ei_tab_add_index(21); ei_tab_add_index(18);
			ei_tab_add_index(19); ei_tab_add_index(22); ei_tab_add_index(4); ei_tab_add_index(1);
			ei_tab_add_index(5); ei_tab_add_index(23); ei_tab_add_index(17); ei_tab_add_index(11);
			ei_tab_add_index(20); ei_tab_add_index(2); ei_tab_add_index(8); ei_tab_add_index(14);
		ei_end_tab();
		ei_param_int("subdiv_iterations", 4);	// subdivide the mesh 4 times
	ei_end_node();

	ei_node("instance", "inst1");				// create object instance
		ei_param_node("element", "obj1");
		ei_param_array("mtl_list", ei_tab(EI_TYPE_TAG_NODE, 1));
			ei_tab_add_node("mtl");
		ei_end_tab();
	ei_end_node();

	ei_node("instgroup", "world");				// create root world
		ei_param_array("instance_list", ei_tab(EI_TYPE_TAG_NODE, 1));
			ei_tab_add_node("caminst1");
			ei_tab_add_node("lightinst1");
			ei_tab_add_node("inst1");
		ei_end_tab();
	ei_end_node();

	ei_render_prepare();
	ei_render_run("world", "caminst1", "opt");	// render frame command
	ei_render_cleanup();

	ei_end_context();							// destroy rendering context

	return 0;
}
void spotlight_test2()
{
	//    Generated by Liquid v2.3.5 (buildtime=22:30:18.85)
	//    Scene : E:/MyDocuments/maya/projects/default/er_spotlight_one
	//    User  : yaoyansi
	//    Time  : Mon Feb 27 22:46:59 2012

	//### SCENE BEGIN ###
	eiContext *CONTEXT = ei_create_context();
	ei_context(CONTEXT);
	//ei_set_connection( &(MayaConnection::getInstance()->connection.base );
	ei_verbose( 6 );
	ei_link( "eiIMG" );
	ei_link( "eiSHADER" );
// 	ei_link( "eiSHADER_maya" );
// 	//----------------phong_shader_for_test begin---
// 	ei_shader("phong_shader_for_test");
// 	ei_shader_param_string("desc","plastic");
// 	ei_shader_param_vector("Cs",1,0.2,0.3);
// 	ei_shader_param_vector("Kd",0.7,1,1);
// 	ei_shader_param_scalar("Ks",1);
// 	ei_shader_param_scalar("roughness",0.2);
// 	ei_end_shader();
// 	ei_shader("opaque_shadow_for_test");
// 	ei_shader_param_string("desc","opaque");
// 	ei_end_shader();
// 	ei_material("phong_mtl_for_test");
// 	ei_add_surface("phong_shader_for_test");
// 	ei_add_shadow("opaque_shadow_for_test");
// 	ei_end_material();
// 	//----------------phong_shader_for_test end ---

	//############################### option #
	ei_options("perspShape_option");
	ei_contrast(0.05,0.05,0.05,0.05);
	ei_samples(0,2);
#ifdef UAE_ESS_DADA
#else
	ei_filter(4,3);
	//transform motion=0, deform motion=0
	ei_motion(0);
	ei_trace_depth(4,4,4);
	ei_displace(1);
	ei_max_displace(1);
	ei_face(3);
#endif
	ei_end_options();
	// maya settings: focal=35, aperture = 36, aspect=1.33333
	//Depth of Field on camera "|persp|perspShape" is turned off in Maya

	//############################### camera #
	ei_camera("|persp|perspShape_object");
	ei_output("E:/MyDocuments/maya/projects/default/rmanpix/er_spotlight_one.perspShape.1.elvishray-2.bmp","bmp",1);
	ei_output_variable("color",10);
	ei_end_output();
#ifdef UAE_ESS_DADA
	ei_focal(1.000000);
	ei_aperture(0.828427);
	ei_aspect(1.33333);
	ei_resolution(640,480);
	//ei_clip(0.1,1000);
#else
	ei_focal(35);
	ei_aperture(36);
	ei_aspect(1.33333);
	ei_resolution(768,576);
	ei_clip(0.1,1000);
#endif
	ei_end_camera();
	//----------------------------------
	ei_instance("|persp|perspShape");
	ei_element("|persp|perspShape_object");
#ifdef UAE_ESS_DADA
	ei_transform(
		0.965926,-0.258819,-0.000000,0.000000,
		0.117501,0.438521,0.891007, 0.000000,
		-0.230609, -0.860646, 0.453990, 0.000000,
		-73.653915, -319.819275, 185.246506, 1.000000
	);
#else
	ei_transform(0.736097,1.38778e-017,0.676876,0,   0.185872,0.961558,-0.202134,0,   -0.650855,0.274603,0.7078,0,   -7.39524,3.14342,5.02456,1);
#endif	
	ei_end_instance();
	//
	// shader(plastic,, ...)
	ei_shader("liquidSurface1");
	ei_shader_param_string( "desc","plastic");
	ei_shader_param_vector("Cs",1,0,0);
	ei_shader_param_vector("Kd",1,1,1);
	ei_shader_param_scalar("Ks",0.5);
	ei_shader_param_scalar("roughness",0.1);
	ei_shader_param_vector("specularcolor",1,1,1);
	ei_end_shader();
	// shader(opaque,, ...)
	ei_shader("liquidSurface2");
	ei_shader_param_string( "desc","opaque");
	ei_end_shader();
	// shader(plastic,, ...)
	ei_shader("liquidSurface3");
	ei_shader_param_string( "desc","plastic");
	ei_shader_param_vector("Cs",0,0,1);
	ei_shader_param_vector("Kd",1,1,1);
	ei_shader_param_scalar("Ks",0.5);
	ei_shader_param_scalar("roughness",0.1);
	ei_shader_param_vector("specularcolor",1,1,1);
	ei_end_shader();

	ei_material("liquidSurface3SG");
	ei_add_surface("liquidSurface3");
	ei_end_material();
	ei_material("liquidSurface1SG");
	ei_add_surface("liquidSurface1");
	ei_add_shadow("liquidSurface2");
	ei_end_material();

	// Renderer::exportLight("_spotLight2_spotLightShape2");

	// Renderer::exportSpotLight()
	ei_shader("|spotLight2|spotLightShape2_shader");
#ifdef UAE_ESS_DADA
	ei_shader_param_string("desc","spotlight");
	ei_shader_param_vector("lightcolor",1,1,1);
	ei_shader_param_scalar("intensity",1);
	ei_shader_param_scalar("deltaangle",0.114319);
	ei_shader_param_vector("direction",0,0,-1);
	ei_shader_param_scalar("spread",0.489565);
#else
	ei_shader_param_string("desc","spotlight");
	ei_shader_param_vector("lightcolor",1,1,1);
	ei_shader_param_scalar("intensity",1);
	ei_shader_param_scalar("deltaangle",0.00152309);
	ei_shader_param_vector("direction",0,0,-1);
	ei_shader_param_scalar("spread",0.0190323);
#endif
	ei_end_shader();
	ei_light("|spotLight2|spotLightShape2_object");
	ei_add_light("|spotLight2|spotLightShape2_shader" );
#ifdef UAE_ESS_DADA
	ei_origin( 0.000000, 0.000000, 0.000000);
#else
	ei_transform(1,0,0,0,   0,1,0,0,   0,0,1,0,   0,0,0,1);
#endif
	ei_end_light();
	ei_instance("|spotLight2|spotLightShape2");
	ei_element("|spotLight2|spotLightShape2_object");
#ifdef UAE_ESS_DADA
	ei_transform(
		1.000000,0.000000,0.000000,0.000000,
		0.000000,1.000000,0.000000,0.000000,
		0.000000,0.000000,1.000000,0.000000,
		4.059041,1.106999,271.584686,1.000000
		);
#else

#endif
	ei_end_instance();

	// Renderer::exportOneGeometry_Mesh(|pCube1|pCubeShape1,0,0)

	//############################### mesh #
	ei_object("pCubeShape1_object","poly");
	{
		eiTag tag;
		//### vertex positions, fnMesh.numVertices()=8
		tag = ei_tab(EI_DATA_TYPE_VECTOR, 1024);
		//tag=220
		ei_pos_list(tag);
		ei_tab_add_vector(-0.5,-0.5,0.5);
		ei_tab_add_vector(0.5,-0.5,0.5);
		ei_tab_add_vector(-0.5,0.5,0.5);
		ei_tab_add_vector(0.5,0.5,0.5);
		ei_tab_add_vector(-0.5,0.5,-0.5);
		ei_tab_add_vector(0.5,0.5,-0.5);
		ei_tab_add_vector(-0.5,-0.5,-0.5);
		ei_tab_add_vector(0.5,-0.5,-0.5);
		ei_end_tab();
		//### UV, size=14
		tag = eiNULL_TAG;
		ei_declare("u",2,5, &tag);
		tag = ei_tab(EI_DATA_TYPE_SCALAR, 1024);
		//tag=224
		ei_variable("u", &tag);
		ei_tab_add_scalar(0.375);
		ei_tab_add_scalar(0.625);
		ei_tab_add_scalar(0.375);
		ei_tab_add_scalar(0.625);
		ei_tab_add_scalar(0.375);
		ei_tab_add_scalar(0.625);
		ei_tab_add_scalar(0.375);
		ei_tab_add_scalar(0.625);
		ei_tab_add_scalar(0.375);
		ei_tab_add_scalar(0.625);
		ei_tab_add_scalar(0.875);
		ei_tab_add_scalar(0.875);
		ei_tab_add_scalar(0.125);
		ei_tab_add_scalar(0.125);
		ei_end_tab();
		tag = eiNULL_TAG;
		ei_declare("v",2,5, &tag);
		tag = ei_tab(EI_DATA_TYPE_SCALAR, 1024);
		//tag=226
		ei_variable("v", &tag);
		ei_tab_add_scalar(0);
		ei_tab_add_scalar(0);
		ei_tab_add_scalar(0.25);
		ei_tab_add_scalar(0.25);
		ei_tab_add_scalar(0.5);
		ei_tab_add_scalar(0.5);
		ei_tab_add_scalar(0.75);
		ei_tab_add_scalar(0.75);
		ei_tab_add_scalar(1);
		ei_tab_add_scalar(1);
		ei_tab_add_scalar(0);
		ei_tab_add_scalar(0.25);
		ei_tab_add_scalar(0);
		ei_tab_add_scalar(0.25);
		ei_end_tab();
		//### triangles, size=[2, 2, 2, 2, 2, 2]
		tag = ei_tab(EI_DATA_TYPE_INDEX, 1024);
		//tag=228
		ei_triangle_list(tag);
		ei_tab_add_index(0);
		ei_tab_add_index(1);
		ei_tab_add_index(2);
		ei_tab_add_index(2);
		ei_tab_add_index(1);
		ei_tab_add_index(3);
		ei_tab_add_index(2);
		ei_tab_add_index(3);
		ei_tab_add_index(4);
		ei_tab_add_index(4);
		ei_tab_add_index(3);
		ei_tab_add_index(5);
		ei_tab_add_index(4);
		ei_tab_add_index(5);
		ei_tab_add_index(6);
		ei_tab_add_index(6);
		ei_tab_add_index(5);
		ei_tab_add_index(7);
		ei_tab_add_index(6);
		ei_tab_add_index(7);
		ei_tab_add_index(0);
		ei_tab_add_index(0);
		ei_tab_add_index(7);
		ei_tab_add_index(1);
		ei_tab_add_index(1);
		ei_tab_add_index(7);
		ei_tab_add_index(3);
		ei_tab_add_index(3);
		ei_tab_add_index(7);
		ei_tab_add_index(5);
		ei_tab_add_index(6);
		ei_tab_add_index(0);
		ei_tab_add_index(4);
		ei_tab_add_index(4);
		ei_tab_add_index(0);
		ei_tab_add_index(2);
		ei_end_tab();
	}//pCubeShape1_object
	ei_end_object();
	//--------------------------
	ei_instance("pCubeShape1");
	ei_add_material("liquidSurface1SG");
	ei_element("pCubeShape1_object");
	ei_transform(0.767864,0,-0.502506,0,   0,0.917675,0,0,   0.502506,0,0.767864,0,   0.0691485,0.091951,-2.25972,1);
	//ribNode->doDef=205, ribNode->doMotion=205
	ei_motion(1);
	ei_end_instance();
	//

	// Renderer::exportOneGeometry_Mesh(|pPlane1|pPlaneShape1,0,0)

	//############################### mesh #
	ei_object("pPlaneShape1_object","poly");
	{
		eiTag tag;
		//### vertex positions, fnMesh.numVertices()=4
		tag = ei_tab(EI_DATA_TYPE_VECTOR, 1024);
		//tag=233
		ei_pos_list(tag);
#ifdef UAE_ESS_DADA
ei_tab_add_vector(-122.330475,-116.084732,0.000000);
ei_tab_add_vector(-61.165237,-116.084732,0.000000);
ei_tab_add_vector(0.000000,-116.084732,0.000000);
ei_tab_add_vector(61.165237,-116.084732,0.000000);
ei_tab_add_vector(122.330475,-116.084732,0.000000);
ei_tab_add_vector(-122.330475,-58.042366,0.000000);
ei_tab_add_vector(-61.165237,-58.042366,0.000000);
ei_tab_add_vector(0.000000,-58.042366,0.000000);
ei_tab_add_vector(61.165237,-58.042366,0.000000);
ei_tab_add_vector(122.330475,-58.042366,0.000000);
ei_tab_add_vector(-122.330475,0.000000,0.000000);
ei_tab_add_vector(-61.165237,0.000000,0.000000);
ei_tab_add_vector(0.000000,0.000000,0.000000);
ei_tab_add_vector(61.165237,0.000000,0.000000);
ei_tab_add_vector(122.330475,0.000000,0.000000);
ei_tab_add_vector(-122.330475,58.042366,0.000000);
ei_tab_add_vector(-61.165237,58.042366,0.000000);
ei_tab_add_vector(0.000000,58.042366,0.000000);
ei_tab_add_vector(61.165237,58.042366,0.000000);
ei_tab_add_vector(122.330475,58.042366,0.000000);
ei_tab_add_vector(-122.330475,116.084732,0.000000);
ei_tab_add_vector(-61.165237,116.084732,0.000000);
ei_tab_add_vector(0.000000,116.084732,0.000000);
ei_tab_add_vector(61.165237,116.084732,0.000000);
ei_tab_add_vector(122.330475,116.084732,0.000000);
#else
		ei_tab_add_vector(-4.76676,-1.12863e-015,5.08292);
		ei_tab_add_vector(4.76676,-1.12863e-015,5.08292);
		ei_tab_add_vector(-4.76676,1.12863e-015,-5.08292);
		ei_tab_add_vector(4.76676,1.12863e-015,-5.08292);
#endif
		ei_end_tab();
		//### N
		tag = eiNULL_TAG;
		ei_declare("N",2,5, &tag);
		tag = ei_tab(EI_DATA_TYPE_VECTOR, 1024);
		//tag=235
		ei_variable("N", &tag);
#ifdef UAE_ESS_DADA
		ei_tab_add_vector(0.000000, 0.000000, 1.000000);
		ei_tab_add_vector(0.000000, 0.000000, 1.000000);
		ei_tab_add_vector(0.000000, 0.000000, 1.000000);
		ei_tab_add_vector(0.000000, 0.000000, 1.000000);
		ei_tab_add_vector(0.000000, 0.000000, 1.000000);
		ei_tab_add_vector(0.000000, 0.000000, 1.000000);
		ei_tab_add_vector(0.000000, 0.000000, 1.000000);
		ei_tab_add_vector(0.000000, 0.000000, 1.000000);
		ei_tab_add_vector(0.000000, 0.000000, 1.000000);
		ei_tab_add_vector(0.000000, 0.000000, 1.000000);
		ei_tab_add_vector(0.000000, 0.000000, 1.000000);
		ei_tab_add_vector(0.000000, 0.000000, 1.000000);
		ei_tab_add_vector(0.000000, 0.000000, 1.000000);
		ei_tab_add_vector(0.000000, 0.000000, 1.000000);
		ei_tab_add_vector(0.000000, 0.000000, 1.000000);
		ei_tab_add_vector(0.000000, 0.000000, 1.000000);
		ei_tab_add_vector(0.000000, 0.000000, 1.000000);
		ei_tab_add_vector(0.000000, 0.000000, 1.000000);
		ei_tab_add_vector(0.000000, 0.000000, 1.000000);
		ei_tab_add_vector(0.000000, 0.000000, 1.000000);
		ei_tab_add_vector(0.000000, 0.000000, 1.000000);
		ei_tab_add_vector(0.000000, 0.000000, 1.000000);
		ei_tab_add_vector(0.000000, 0.000000, 1.000000);
		ei_tab_add_vector(0.000000, 0.000000, 1.000000);
		ei_tab_add_vector(0.000000, 0.000000, 1.000000);
#else
		ei_tab_add_vector(0,1,2.22045e-016);
		ei_tab_add_vector(0,1,2.22045e-016);
		ei_tab_add_vector(0,1,2.22045e-016);
		ei_tab_add_vector(0,1,2.22045e-016);
#endif
		ei_end_tab();

#ifdef UAE_ESS_DADA

#else		//### UV, size=4
		tag = eiNULL_TAG;
		ei_declare("u",2,5, &tag);
		tag = ei_tab(EI_DATA_TYPE_SCALAR, 1024);
		//tag=237
		ei_variable("u", &tag);
		ei_tab_add_scalar(0);
		ei_tab_add_scalar(0.937799);
		ei_tab_add_scalar(0);
		ei_tab_add_scalar(0.937799);
		ei_end_tab();
		tag = eiNULL_TAG;
		ei_declare("v",2,5, &tag);
		tag = ei_tab(EI_DATA_TYPE_SCALAR, 1024);
		//tag=239
		ei_variable("v", &tag);
		ei_tab_add_scalar(0);
		ei_tab_add_scalar(0);
		ei_tab_add_scalar(1);
		ei_tab_add_scalar(1);
		ei_end_tab();
#endif
		//### triangles, size=[2]
		tag = ei_tab(EI_DATA_TYPE_INDEX, 1024);
		//tag=241
		ei_triangle_list(tag);
#ifdef UAE_ESS_DADA
			ei_tab_add_index(5);ei_tab_add_index(0);ei_tab_add_index(6);
			ei_tab_add_index(1);ei_tab_add_index(6);ei_tab_add_index(0);
			ei_tab_add_index(6);ei_tab_add_index(1);ei_tab_add_index(7);
			ei_tab_add_index(2);ei_tab_add_index(7);ei_tab_add_index(1);
			ei_tab_add_index(7);ei_tab_add_index(2);ei_tab_add_index(8);
			ei_tab_add_index(3);ei_tab_add_index(8);ei_tab_add_index(2);
			ei_tab_add_index(8);ei_tab_add_index(3);ei_tab_add_index(9);
			ei_tab_add_index(4);ei_tab_add_index(9);ei_tab_add_index(3);
			ei_tab_add_index(10);ei_tab_add_index(5);ei_tab_add_index(11);
			ei_tab_add_index(6);ei_tab_add_index(11);ei_tab_add_index(5);
			ei_tab_add_index(11);ei_tab_add_index(6);ei_tab_add_index(12);
			ei_tab_add_index(7);ei_tab_add_index(12);ei_tab_add_index(6);
			ei_tab_add_index(12);ei_tab_add_index(7);ei_tab_add_index(13);
			ei_tab_add_index(8);ei_tab_add_index(13);ei_tab_add_index(7);
			ei_tab_add_index(13);ei_tab_add_index(8);ei_tab_add_index(14);
			ei_tab_add_index(9);ei_tab_add_index(14);ei_tab_add_index(8);
			ei_tab_add_index(15);ei_tab_add_index(10);ei_tab_add_index(16);
			ei_tab_add_index(11);ei_tab_add_index(16);ei_tab_add_index(10);
			ei_tab_add_index(16);ei_tab_add_index(11);ei_tab_add_index(17);
			ei_tab_add_index(12);ei_tab_add_index(17);ei_tab_add_index(11);
			ei_tab_add_index(17);ei_tab_add_index(12);ei_tab_add_index(18);
			ei_tab_add_index(13);ei_tab_add_index(18);ei_tab_add_index(12);
			ei_tab_add_index(18);ei_tab_add_index(13);ei_tab_add_index(19);
			ei_tab_add_index(14);ei_tab_add_index(19);ei_tab_add_index(13);
			ei_tab_add_index(20);ei_tab_add_index(15);ei_tab_add_index(21);
			ei_tab_add_index(16);ei_tab_add_index(21);ei_tab_add_index(15);
			ei_tab_add_index(21);ei_tab_add_index(16);ei_tab_add_index(22);
			ei_tab_add_index(17);ei_tab_add_index(22);ei_tab_add_index(16);
			ei_tab_add_index(22);ei_tab_add_index(17);ei_tab_add_index(23);
			ei_tab_add_index(18);ei_tab_add_index(23);ei_tab_add_index(17);
			ei_tab_add_index(23);ei_tab_add_index(18);ei_tab_add_index(24);
			ei_tab_add_index(19);ei_tab_add_index(24);ei_tab_add_index(18);
#else	
		ei_tab_add_index(0);
		ei_tab_add_index(1);
		ei_tab_add_index(2);
		ei_tab_add_index(2);
		ei_tab_add_index(1);
		ei_tab_add_index(3);
#endif
		ei_end_tab();
	}//pPlaneShape1_object
	ei_end_object();
	//--------------------------
	ei_instance("pPlaneShape1");
	ei_add_material("liquidSurface3SG");
	ei_element("pPlaneShape1_object");
#ifdef UAE_ESS_DADA
	ei_transform(
		1.000000,0.000000,0.000000,0.000000,
		0.000000,1.000000,0.000000,0.000000,
		0.000000,0.000000,1.000000,0.000000,
		5.742889,6.604416,0.000000,1.000000
	);
#else	
	ei_transform(1,0,0,0,   0,1,0,0,   0,0,1,0,   0.747431,-0.565344,-3.9602,1);
#endif
	//ribNode->doDef=205, ribNode->doMotion=205
	ei_motion(1);
	ei_end_instance();
	//

	//Renderer::worldEpilogue()
	ei_instgroup("perspShape");
	//camera
	ei_add_instance("|persp|perspShape");
	//lightlinks and meshes
	ei_add_instance("|spotLight2|spotLightShape2");
	//ei_add_instance("pCubeShape1");
	//lightlinks and meshes
	//ei_add_instance("|spotLight2|spotLightShape2");
	ei_add_instance("pPlaneShape1");
	ei_end_instgroup( );
	ei_render("perspShape", "|persp|perspShape", "perspShape_option");
	ei_delete_context(CONTEXT);

}
void er_maketexture(const std::string &source_image_dir, 
					const std::string &source_image_name, 
					const std::string &source_image_ext)
{
	char	tmp[ EI_MAX_FILE_NAME_LEN ];
	ei_get_current_directory(tmp);
	std::string cur_dir(tmp);
	cur_dir = boost::replace_all_copy( cur_dir, "\\", "/" );

	char	output_filename[ EI_MAX_FILE_NAME_LEN ];



	ei_context();
	ei_verbose( 6 );
	ei_link( "eiIMG" );
	ei_link( "eiSHADER" );
	ei_link( "eiSHADER_maya" );

	//############################### option #;
	ei_options("perspShape_option");
	ei_contrast(0.05);
	ei_samples(0,2);
	ei_filter(4,3);
	//transform motion=0, deform motion=0;
	ei_motion(0);
	ei_trace_depth(4,4,4,4,4,4);
	ei_displace(0);
	ei_face(3);
	ei_end_options();
	// maya settings: focal=35, aperture = 46.8, aspect=1.33333;
	//Depth of Field on camera "|persp|perspShape" is turned off in Maya;

	//############################### camera #;
	ei_camera("|persp|perspShape_object");
	//beauty channel;
	ei_output( (cur_dir+"/er_maketexture_output.bmp").c_str(), "bmp",1);
	printf("rendering result:%s\n",(cur_dir+"/er_maketexture_output.bmp").c_str());
	//mode=rgb;
	ei_output_variable("color",11);
	ei_end_output();
	// AOV;
	// AOV end;
	ei_focal(35);
	ei_aperture(36);
	ei_aspect(1.33333);
	ei_resolution(800,600);
	ei_clip(0.1,10000);
	ei_end_camera();
	//----------------------------------;
	ei_instance("|persp|perspShape");
	ei_element("|persp|perspShape_object");
	ei_transform(0.999945,0,-0.0104718,0,   -0.0104706,0.015038,-0.999832,0,   0.000157475,0.999887,0.0150372,0,   -2.6803,10.6466,-0.386112,1);
	ei_end_instance();
	//;
	ei_shader("maya_place2dTexture", "place2dTexture1");
	ei_shader_param_int("liq_UserDefinedU",0);
	ei_shader_param_int("liq_UserDefinedV",0);
	ei_shader_param_vector("i_uvCoord",0,0,0);
	ei_shader_param_scalar("i_coverageU", 1);
	ei_shader_param_scalar("i_coverageV", 1);
	ei_shader_param_bool("i_mirrorU", 0);
	ei_shader_param_bool("i_mirrorV", 0);
	ei_shader_param_scalar("i_noiseU", 0);
	ei_shader_param_scalar("i_noiseV", 0);
	ei_shader_param_scalar("i_offsetU", 0);
	ei_shader_param_scalar("i_offsetV", 0);
	ei_shader_param_scalar("i_repeatU", 1);
	ei_shader_param_scalar("i_repeatV", 1);
	ei_shader_param_scalar("i_rotateFrame", 0);
	ei_shader_param_scalar("i_rotateUV", 0);
	ei_shader_param_bool("i_stagger", 0);
	ei_shader_param_scalar("i_translateFrameU", 0);
	ei_shader_param_scalar("i_translateFrameV", 0);
	ei_shader_param_bool("i_wrapU", 1);
	ei_shader_param_bool("i_wrapV", 1);
	ei_shader_param_vector("o_outUV", 0, 0, 0);
	ei_end_shader();

	//make texture
	const std::string src_image_fullpath(source_image_dir+"/"+source_image_name);
	std::string des_image_fullpath(cur_dir+"/"+source_image_name);

	if(source_image_ext != "tex")
	{
		des_image_fullpath += ".tex";
		ei_make_texture( 
			src_image_fullpath.c_str(),
			des_image_fullpath.c_str(),
			EI_TEX_WRAP_CLAMP, EI_TEX_WRAP_CLAMP, EI_FILTER_BOX, 1.0f, 1.0f);
	}
	printf("des image:%s\n", des_image_fullpath.c_str());

	ei_texture( src_image_fullpath.c_str() );
	ei_file_texture( des_image_fullpath.c_str(), eiFALSE);
	ei_end_texture();


	ei_shader("maya_file", "file1");
	ei_shader_param_scalar("i_alphaGain", 1);
	ei_shader_param_bool("i_alphaIsLuminance", 0);
	ei_shader_param_scalar("i_alphaOffset", 0);
	ei_shader_param_vector("i_colorGain", 1, 1, 1);
	ei_shader_param_vector("i_colorOffset", 0, 0, 0);
	ei_shader_param_vector("i_defaultColor", 0.5, 0.5, 0.5);
	ei_shader_link_param("i_uvCoord", "place2dTexture1", "o_outUV");
	ei_shader_param_texture("i_fileTextureName", src_image_fullpath.c_str() );
	ei_shader_param_index("i_filterType", 3);
	ei_shader_param_scalar("i_filter", 1);
	ei_shader_param_scalar("i_filterOffset", 0);
	ei_shader_param_bool("i_invert", 0);
	ei_shader_param_bool("i_fileHasAlpha", 0);
	ei_shader_param_scalar("o_outAlpha", 1);
	ei_shader_param_vector("o_outColor", 0, 0, 0);
	ei_shader_param_vector("o_outTransparency", 0, 0, 0);
	ei_end_shader();

	ei_shader("maya_phong", "phong1");
	ei_shader_param_vector("i_ambientColor", 0, 0, 0);
	ei_shader_link_param("i_color", "file1", "o_outColor");
	ei_shader_param_vector("i_transparency", 0, 0, 0);
	ei_shader_param_vector("i_incandescence", 0, 0, 0);
	ei_shader_param_int("liq_UserDefinedNormal", 0);
	ei_shader_param_vector("i_normalCamera", 1, 1, 1);
	ei_shader_param_scalar("i_diffuse", 0.8);
	ei_shader_param_scalar("i_translucence", 0);
	ei_shader_param_scalar("i_translucenceDepth", 0.5);
	ei_shader_param_scalar("i_translucenceFocus", 0.5);
	ei_shader_param_scalar("i_cosinePower", 20);
	ei_shader_param_vector("i_specularColor", 0.5, 0.5, 0.5);
	ei_shader_param_scalar("i_reflectivity", 0.5);
	ei_shader_param_vector("i_reflectedColor", 0, 0, 0);
	ei_shader_param_index("i_matteOpacityMode", 2);
	ei_shader_param_scalar("i_matteOpacity", 1);
	ei_shader_param_index("i_reflectionLimit", 1);
	ei_shader_param_vector("o_outColor", 0, 0, 0);
	ei_shader_param_vector("o_outTransparency", 0, 0, 0);
	ei_end_shader();

	ei_material("phong1SG");
	ei_surface_shader("phong1");
	ei_end_material();

	//worldPrologue;

	// Renderer::exportLight("_pointLight1_pointLightShape1");;

	// Renderer::exportPointLight();
	ei_shader("pointlight", "|pointLight1|pointLightShape1_shader");
	ei_shader_param_vector("lightcolor",1,1,1);
	ei_shader_param_scalar("intensity",1);
	ei_end_shader();
	ei_light("|pointLight1|pointLightShape1_object");
	ei_light_shader("|pointLight1|pointLightShape1_shader" );
	ei_origin(0,0,0);
	ei_end_light();
	ei_instance("|pointLight1|pointLightShape1");
	ei_element("|pointLight1|pointLightShape1_object");
	ei_transform(1,0,0,0,   0,1,0,0,   0,0,1,0,   0,5.23026,0,1);
	{;
	eiInt tag = 0;
	ei_declare("|pPlane2_lightgroup",0,4, &tag);
	};
	ei_end_instance();

	// Renderer::exportLight("_pointLight2_pointLightShape2");;

	// Renderer::exportPointLight();
	ei_shader("pointlight", "|pointLight2|pointLightShape2_shader");
	ei_shader_param_vector("lightcolor",1,1,1);
	ei_shader_param_scalar("intensity",1);
	ei_end_shader();
	ei_light("|pointLight2|pointLightShape2_object");
	ei_light_shader("|pointLight2|pointLightShape2_shader" );
	ei_origin(0,0,0);
	ei_end_light();
	ei_instance("|pointLight2|pointLightShape2");
	ei_element("|pointLight2|pointLightShape2_object");
	ei_transform(1,0,0,0,   0,1,0,0,   0,0,1,0,   -5.18346,1.22941,0,1);
	{;
	eiInt tag = 0;
	ei_declare("|pPlane2_lightgroup",0,4, &tag);
	};
	ei_end_instance();

	// Renderer::exportOneGeometry_Mesh(|pPlane2|pPlaneShape11,0,0);

	//############################### mesh #;
	//shape full path name=|pPlane2|pPlaneShape11;
	ei_object("poly","|pPlane2|pPlaneShape11");
	{;
	eiTag tag;
	//### vertex positions, fnMesh.numVertices()=9;
	tag = ei_tab(EI_TYPE_VECTOR, 1, 1024);
	ei_pos_list(tag);
	ei_tab_add_vector(-0.5,-1.11022e-016,0.5);
	ei_tab_add_vector(0,-1.11022e-016,0.5);
	ei_tab_add_vector(0.5,-1.11022e-016,0.5);
	ei_tab_add_vector(-0.5,0,0);
	ei_tab_add_vector(0,0,0);
	ei_tab_add_vector(0.5,0,0);
	ei_tab_add_vector(-0.5,1.11022e-016,-0.5);
	ei_tab_add_vector(0,1.11022e-016,-0.5);
	ei_tab_add_vector(0.5,1.11022e-016,-0.5);
	ei_end_tab();
	//### N ###;
	tag = eiNULL_TAG;
	ei_declare("N",2,6, &tag);
	tag = ei_tab(EI_TYPE_VECTOR, 1, 1024);
	ei_variable("N", &tag);
	ei_tab_add_vector(0,1,2.22045e-016);
	ei_tab_add_vector(0,1,2.22045e-016);
	ei_tab_add_vector(0,1,2.22045e-016);
	ei_tab_add_vector(0,1,2.22045e-016);
	ei_tab_add_vector(0,1,2.22045e-016);
	ei_tab_add_vector(0,1,2.22045e-016);
	ei_tab_add_vector(0,1,2.22045e-016);
	ei_tab_add_vector(0,1,2.22045e-016);
	ei_tab_add_vector(0,1,2.22045e-016);
	ei_end_tab();
	//### N ### end;
	//### UV(map1), size=9;
	tag = eiNULL_TAG;
	ei_declare("uv",2,6, &tag);
	tag = ei_tab(EI_TYPE_VECTOR2, 1, 1024);
	ei_variable("uv", &tag);
	ei_tab_add_vector2(0,0);
	ei_tab_add_vector2(0.5,0);
	ei_tab_add_vector2(1,0);
	ei_tab_add_vector2(0,0.5);
	ei_tab_add_vector2(0.5,0.5);
	ei_tab_add_vector2(1,0.5);
	ei_tab_add_vector2(0,1);
	ei_tab_add_vector2(0.5,1);
	ei_tab_add_vector2(1,1);
	ei_end_tab();
	//### triangles, size=4;
	tag = ei_tab(EI_TYPE_INDEX, 1, 1024);
	ei_triangle_list(tag);
	ei_tab_add_index(0);
	ei_tab_add_index(1);
	ei_tab_add_index(3);
	ei_tab_add_index(3);
	ei_tab_add_index(1);
	ei_tab_add_index(4);
	ei_tab_add_index(1);
	ei_tab_add_index(2);
	ei_tab_add_index(4);
	ei_tab_add_index(4);
	ei_tab_add_index(2);
	ei_tab_add_index(5);
	ei_tab_add_index(3);
	ei_tab_add_index(4);
	ei_tab_add_index(6);
	ei_tab_add_index(6);
	ei_tab_add_index(4);
	ei_tab_add_index(7);
	ei_tab_add_index(4);
	ei_tab_add_index(5);
	ei_tab_add_index(7);
	ei_tab_add_index(7);
	ei_tab_add_index(5);
	ei_tab_add_index(8);
	ei_end_tab();
	}//|pPlane2|pPlaneShape11;
	ei_end_object();
	//--------------------------;
	//ribNode->name=|pPlane2|pPlaneShape11;
	//ribNode's transform node=|pPlane2;
	//ribNode->object(0)->getDataPtr()->getFullPathName()=|pPlane2|pPlaneShape11;
	ei_instance("|pPlane2");
	ei_mtl("phong1SG");
	//shape name=|pPlane2|pPlaneShape11;
	//shape full path name=|pPlane2|pPlaneShape11;
	ei_element("|pPlane2|pPlaneShape11");
	ei_transform(9.6133,0,0,0,   0,1,0,0,   0,0,8.02763,0,   -2.76716,0,-0.566055,1);
	//ribNode->doDef=205, ribNode->doMotion=205;
	ei_motion(1);
	{//light group(light-link group);
	const char *tag = NULL;
	ei_declare("lightgroup",0,1, &tag);
	tag = ei_token("|pPlane2_lightgroup");;
	ei_variable("lightgroup", &tag);
	};
	ei_end_instance();
	//;

	//Renderer::worldEpilogue();
	ei_instgroup("perspShape");
	//camera;
	ei_add_instance("|persp|perspShape");
	//light(s);
	ei_add_instance("|pointLight1|pointLightShape1");
	ei_add_instance("|pointLight2|pointLightShape2");
	//mesh(s);
	ei_add_instance("|pPlane2");
	ei_end_instgroup( );
	//ei_set_connection( &(MayaConnection::getInstance()->connection.base );
	ei_render("perspShape", "|persp|perspShape", "perspShape_option");
	ei_end_context();

}