Beispiel #1
0
      //! \brief commit the material's parameters
      virtual void commit() override
      {
        if (getIE() == nullptr) {
          ispcEquivalent = ispc::PathTracer_Glass_create();
        }

        const float etaInside = getParamf("etaInside", getParamf("eta", 1.5f));

        const float etaOutside = getParamf("etaOutside", 1.f);

        const vec3f& attenuationColorInside =
          getParam3f("attenuationColorInside",
          getParam3f("attenuationColor",
          getParam3f("color", vec3f(1.f))));

        const vec3f& attenuationColorOutside =
          getParam3f("attenuationColorOutside", vec3f(1.f));

        const float attenuationDistance =
          getParamf("attenuationDistance", getParamf("distance", 1.0f));

        ispc::PathTracer_Glass_set(
          ispcEquivalent,
          etaInside,
          (const ispc::vec3f&)attenuationColorInside,
          etaOutside,
          (const ispc::vec3f&)attenuationColorOutside,
          attenuationDistance);
      }
  void PerspectiveCamera::commit()
  {
    // ------------------------------------------------------------------
    // first, "parse" the expected parameters
    // ------------------------------------------------------------------
    pos    = getParam3f("pos",vec3fa(0.f));
    dir    = getParam3f("dir",vec3fa(0.f,0.0f,1.f));
    up     = getParam3f("up", vec3fa(0.f,1.0f,0.f));
    near   = getParamf("near",0.f);
    far    = getParamf("far", std::numeric_limits<float>::infinity());
    fovy   = getParamf("fovy",60.f);
    aspect = getParamf("aspect",1.f);

    // ------------------------------------------------------------------
    // now, update the local precomptued values
    // ------------------------------------------------------------------
    vec3f dz = normalize(dir);
    vec3f dx = normalize(cross(dz,up));
    vec3f dy = normalize(cross(dx,dz));

    float imgPlane_size_y = 2.f*sinf(fovy/2.f*M_PI/180.);
    float imgPlane_size_x = imgPlane_size_y * aspect;
    dir_00
      = dz
      - (.5f * imgPlane_size_x) * dx
      - (.5f * imgPlane_size_y) * dy;
    dir_du = dx * imgPlane_size_x;
    dir_dv = dy * imgPlane_size_y;

    ispc::PerspectiveCamera_set(getIE(),
                                (const ispc::vec3f&)pos,
                                (const ispc::vec3f&)dir_00,
                                (const ispc::vec3f&)dir_du,
                                (const ispc::vec3f&)dir_dv);
  }
Beispiel #3
0
      //! \brief commit the material's parameters
      virtual void commit() override
      {
        const vec3f pigmentColor = getParam3f("pigmentColor",vec3f(1.f));
        const float eta          = getParamf("eta",1.4f);
        const float roughness    = getParamf("roughness",0.01f);

        ispc::PathTracer_Plastic_set
          (getIE(), (const ispc::vec3f&)pigmentColor,eta,roughness);
      }
Beispiel #4
0
      //! \brief commit the material's parameters
      virtual void commit() {
        if (getIE() != NULL) return;

        const vec3f pigmentColor = getParam3f("pigmentColor",vec3f(1.f));
        const float eta          = getParamf("eta",1.4f);
        const float roughness    = getParamf("roughness",0.01f);
        // const float rcpRoughness = rcpf(roughness);

        ispcEquivalent = ispc::PathTracer_Plastic_create
          ((const ispc::vec3f&)pigmentColor,eta,roughness);
      }
Beispiel #5
0
      //! \brief commit the material's parameters
      virtual void commit() override
      {
        const vec3f& color = getParam3f("color", vec3f(0.9f));
        Texture2D *map_color = (Texture2D*)getParamObject("map_color");
        affine2f xform_color = getTextureTransform("map_color");

        const vec3f& edgeColor = getParam3f("edgeColor", vec3f(1.f));
        Texture2D *map_edgeColor = (Texture2D*)getParamObject("map_edgeColor");
        affine2f xform_edgeColor = getTextureTransform("map_edgeColor");

        const float roughness = getParamf("roughness", 0.1f);
        Texture2D *map_roughness = (Texture2D*)getParamObject("map_roughness");
        affine2f xform_roughness = getTextureTransform("map_roughness");

        ispc::PathTracer_Alloy_set(getIE()
            , (const ispc::vec3f&)color
            , map_color ? map_color->getIE() : nullptr
            , (const ispc::AffineSpace2f&)xform_color
            , (const ispc::vec3f&)edgeColor
            , map_edgeColor ? map_edgeColor->getIE() : nullptr
            , (const ispc::AffineSpace2f&)xform_edgeColor
            , roughness
            , map_roughness ? map_roughness->getIE() : nullptr
            , (const ispc::AffineSpace2f&)xform_roughness
            );
      }
Beispiel #6
0
void midiCallback(double deltatime, std::vector< unsigned char > *message, void *userData)
{
	unsigned int nBytes = message->size();
	for (unsigned int i = 0; i<nBytes; i++)
		std::cout << "Byte " << i << " = " << (int)message->at(i) << ", ";
	if (nBytes > 0)
		std::cout << "stamp = " << deltatime << std::endl;
	
	if (nBytes > 2)
	{
		
		if (message->at(0) == 176)
		{
			if (message->at(1) == 16)
			{
				gVRTeleportRotZ= getParamf(-3.1415, 3.1415, message->at(2));
				gVRTeleportOrn = btQuaternion(btVector3(0, 0, 1), gVRTeleportRotZ);
				saveCurrentSettingsVR();
				b3Printf("gVRTeleportOrn rotZ = %f\n", gVRTeleportRotZ);
			}

			if (message->at(1) == 32)
			{
				gCreateDefaultRobotAssets = 1;
			}

			for (int i = 0; i < 3; i++)
			{
				if (message->at(1) == i)
				{
					gVRTeleportPos1[i] = getParamf(-2, 2, message->at(2));
					saveCurrentSettingsVR();
					b3Printf("gVRTeleportPos[%d] =  %f\n", i,gVRTeleportPos1[i]);

				}
			}
		}
	}
}
Beispiel #7
0
	GLfloat* Texture::getBorderColor()
	{
		GLfloat* param;
		getParamf(GL_TEXTURE_BORDER_COLOR, param);
		return param;
	}