void GhostBlockBrickedVolume::createEquivalentISPC() { // Get the voxel type. voxelType = getParamString("voxelType", "unspecified"); exitOnCondition(getVoxelType() == OSP_UNKNOWN, "unrecognized voxel type (must be set before calling " "ospSetRegion())"); // Get the volume dimensions. this->dimensions = getParam3i("dimensions", vec3i(0)); exitOnCondition(reduce_min(this->dimensions) <= 0, "invalid volume dimensions (must be set before calling " "ospSetRegion())"); // Create an ISPC GhostBlockBrickedVolume object and assign type-specific // function pointers. ispcEquivalent = ispc::GBBV_createInstance(this, (int)getVoxelType(), (const ispc::vec3i &)this->dimensions); }
void BlockBrickedVolume::createEquivalentISPC() { //! Get the voxel type. voxelType = getParamString("voxelType", "unspecified"); exitOnCondition(getVoxelType() == OSP_UNKNOWN, "unrecognized voxel type"); //! Create an ISPC BlockBrickedVolume object and assign type-specific function pointers. ispcEquivalent = ispc::BlockBrickedVolume_createInstance((int) getVoxelType()); //! Get the volume dimensions. volumeDimensions = getParam3i("dimensions", vec3i(0)); exitOnCondition(reduce_min(volumeDimensions) <= 0, "invalid volume dimensions"); //! Get the transfer function. transferFunction = (TransferFunction *) getParamObject("transferFunction", NULL); exitOnCondition(transferFunction == NULL, "no transfer function specified"); //! Get the value range. //! Voxel range not used for now. // vec2f voxelRange = getParam2f("voxelRange", vec2f(0.0f)); exitOnCondition(voxelRange == vec2f(0.0f), "no voxel range specified"); //! Get the gamma correction coefficient and exponent. vec2f gammaCorrection = getParam2f("gammaCorrection", vec2f(1.0f)); //! Set the volume dimensions. ispc::BlockBrickedVolume_setVolumeDimensions(ispcEquivalent, (const ispc::vec3i &) volumeDimensions); //! Set the value range (must occur before setting the transfer function). //ispc::BlockBrickedVolume_setValueRange(ispcEquivalent, (const ispc::vec2f &) voxelRange); //! Set the transfer function. ispc::BlockBrickedVolume_setTransferFunction(ispcEquivalent, transferFunction->getEquivalentISPC()); //! Set the recommended sampling rate for ray casting based renderers. ispc::BlockBrickedVolume_setSamplingRate(ispcEquivalent, getParam1f("samplingRate", 1.0f)); //! Set the gamma correction coefficient and exponent. ispc::BlockBrickedVolume_setGammaCorrection(ispcEquivalent, (const ispc::vec2f &) gammaCorrection); //! Allocate memory for the voxel data in the ISPC object. ispc::BlockBrickedVolume_allocateMemory(ispcEquivalent); }