Exemple #1
0
extern "C" void bind_appleseed_python_classes()
{
    boost::python::scope().attr("APPLESEED_VERSION") = APPLESEED_VERSION;
    boost::python::scope().attr("APPLESEED_VERSION_MAJOR") = APPLESEED_VERSION_MAJOR;
    boost::python::scope().attr("APPLESEED_VERSION_MINOR") = APPLESEED_VERSION_MINOR;
    boost::python::scope().attr("APPLESEED_VERSION_PATCH") = APPLESEED_VERSION_PATCH;
    boost::python::scope().attr("APPLESEED_VERSION_MATURITY") = APPLESEED_VERSION_MATURITY;
    boost::python::scope().attr("APPLESEED_VERSION_STRING") = APPLESEED_VERSION_STRING;

    bind_utility();
    bind_murmurhash();
    bind_logger();

    bind_vector();
    bind_basis();
    bind_quaternion();
    bind_bbox();
    bind_matrix();
    bind_transform();

    bind_entity();

    bind_color();
    bind_texture();
    bind_bsdf();
    bind_bssrdf();
    bind_edf();
    bind_shader_group();

    bind_surface_shader();
    bind_material();
    bind_light();
    bind_object();
    bind_mesh_object();
    bind_assembly();

    bind_camera();
    bind_environment();
    bind_scene();

    bind_image();
    bind_aov();
    bind_frame();
    bind_fresnel();
    bind_display();
    bind_project();

    bind_renderer_controller();
    bind_tile_callback();
    bind_master_renderer();
}
Exemple #2
0
	void x3ds_instance::create_mesh_list(Lib3dsMesh* mesh)
	{
		Lib3dsVector* normalL = (Lib3dsVector*) malloc(3 * sizeof(Lib3dsVector) * mesh->faces);
		Lib3dsMatrix m;
		lib3ds_matrix_copy(m, mesh->matrix);
		lib3ds_matrix_inv(m);
		glMultMatrixf(&m[0][0]);

		lib3ds_mesh_calculate_normals(mesh, normalL);

		Lib3dsMaterial* prev_mat = NULL;
		for (Uint32 p = 0; p < mesh->faces; ++p)
		{
			Lib3dsFace* f = &mesh->faceL[p];
			Lib3dsMaterial* mat = f->material[0] ? 
				lib3ds_file_material_by_name(m_def->m_file, f->material) : NULL;

			if (prev_mat != mat)
			{
				set_material(mat);
			}

			glBegin(GL_TRIANGLES);
			glNormal3fv(f->normal);
			for (int i = 0; i < 3; ++i)
			{
				glNormal3fv(normalL[3 * p + i]);
				if (mesh->texelL)
				{
					bind_material(mat, mesh->texelL[f->points[i]][1], mesh->texelL[f->points[i]][0]);
				}
				glVertex3fv(mesh->pointL[f->points[i]].pos);
			}
			glEnd();
			glDisable(GL_TEXTURE_2D);
		}

		free(normalL);
	}
Exemple #3
0
void ceDeviceGL20::ApplyShaderStates (ceSharedShaderBinding* bindings)
{
  assert (_program);
  CE_CHECK_GL_ERROR;

  iProgramParameter *pp = _program->GetParameter(PPB_MatrixWorld);
  if (pp)
    {
      pp->Bind(_matrices[MS_World]);
    }



	if (_light)
		{
			_light->Bind(_program);
		}
  bind_material(_program, _material);

	if (bindings)
		{
			bindings->Bind (ceSharedValueManager::Get (), _program);
		}

	if (_material->Transparency)
		{
			glEnable (GL_BLEND);
			glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
		}
	else
		{
      if (_useBlend)
        {
          glEnable(GL_BLEND);
        }
      else
        {
          glDisable(GL_BLEND);
        }
		}

	glDepthMask (_material->WriteDepth);

  glEnable (GL_VERTEX_PROGRAM_POINT_SIZE);
  glEnable (GL_PROGRAM_POINT_SIZE);


  if (_pass == RP_Shadow)
		{
			for (unsigned i=0; i<3; i++)
				{
					if (_shadowMap[i].ShadowMap)
						{
							SetTexture ((ceTextureStage)(TS_Texture5 + i), _shadowMap[i].ShadowMap);
							pp = _program->GetParameter((ceProgramParameterBinding)(PPB_ShadowMap0Matrix + i));
							if (pp)
								{
									pp->Bind (_shadowMap[i].Matrix);
								}
						}
				}
		}
  else if (_pass == RP_Diffuse)
    {
      if (_shadowOverlayer)
        {
          SetTexture(TS_Texture5, _shadowOverlayer);
        }
    }


  for (unsigned i = 0; i < TS_Count; i++)
    {
      iTexture* texture = _textures[i];
      if (texture)
        {
          switch (texture->GetTextureType ())
            {
            case TT_Texture2D:
              {
                glActiveTexture (GL_TEXTURE0 + i);
                texture->Bind();

                iProgramParameter* parameter = _program->GetParameter(convert_program_parameter_binding(i));
                if (parameter)
                  {
                    parameter->Bind((ceTextureStage)i, (iTexture2D*)texture);
                  }
              }
              break;
            default:
              break;
            }
        }
    }
}