Esempio n. 1
0
File: image.cpp Progetto: ICRAR/void
vd::status
ImageOutput::WriteTile(
	vd::i32 x, vd::i32 y, vd::i32 z,
	const PixelBuffer32f& pixels, size_t offset,
	size_t xstride, size_t ystride, size_t zstride)
{
	OiioImageOutput* output = reinterpret_cast<OiioImageOutput*>(m_Handle);
	vdAssert(output != NULL);

	if(m_Format.Tiles.Width <= 0 || m_Format.Tiles.Height <= 0)
	{
		vdLogWarning("Failed to write tile to image -- invalid tile size used in image format!");
		return Status::Code::ReadError;
	}
/*	
	if(!output->write_tile (x, y, z, OiioTypeDesc::FLOAT, ((char*)pixels.Data) + offset, 
							xstride ? xstride : OiioAutoStride,
							ystride ? ystride : OiioAutoStride,
							zstride ? zstride : OiioAutoStride))
*/
	if(!output->write_tile (x, y, z, OiioTypeDesc::FLOAT, ((char*)pixels.Data)))
	{
		vdLogWarning("Failed to save tile [%d,%d,%d] to image '%s'!", x, y, z, m_Location.c_str());
		return Status::Code::ReadError;
	}

	vdLogInfo("Saved tile [%d,%d,%d] %d x %d (%d channels - 32bit float) from '%s'!", 
		x,y,z, m_Format.Tiles.Width, m_Format.Height, m_Format.Channels.Count, m_Location.c_str());	

	return Status::Code::Success;
}
Esempio n. 2
0
vd::status 
Context::OnMouseWheel(const Event & event)
{
	vdAssert(m_Input);
	m_Input->OnEvent(event);
    return Status::Code::Success;
}
Esempio n. 3
0
vd::status
Shader::Unbind()
{
    vdAssert(m_Data.Usage > 0);
    m_Data.Usage--;
    return Status::Code::Success;
}
Esempio n. 4
0
File: image.cpp Progetto: ICRAR/void
vd::status
ImageInput::ReadTile(
	vd::i32 x, vd::i32 y, vd::i32 z,
	PixelBuffer32f& pixels)
{
	OiioImageInput* input = reinterpret_cast<OiioImageInput*>(m_Handle);
	vdAssert(input != NULL);

	if(m_Format.Tiles.Width <= 0 || m_Format.Tiles.Height <= 0)
	{
		vdLogWarning("Failed to read tile from image -- invalid tile size used in image format!");
		return Status::Code::ReadError;
	}
	
	pixels.Setup(m_Format.Channels, m_Format.Tiles.Width * m_Format.Tiles.Height);
	
	if(!input->read_tile (x, y, z, OiioTypeDesc::FLOAT, pixels.Data))
	{
		vdLogWarning("Failed to load image from file '%s'!", m_Location.c_str());
		return Status::Code::ReadError;
	}

	vdLogInfo("Loaded tile [%d,%d,%d] %d x %d (%d channels - 8-bit unsigned) from '%s'!", 
		x,y,z, m_Format.Tiles.Width, m_Format.Height, m_Format.Channels.Count, m_Location.c_str());	

	return Status::Code::Success;
}
Esempio n. 5
0
Object::~Object()
{
#if !defined(VD_RELEASE_BUILD)
	vd::i32 count = GetRefCount();
#if defined(VD_DEBUG_REFCOUNTS)    
    if(count > 0)
    {
        vdLogWarning("Deleting %s with reference count %i!",
            ToString().c_str(), count);
    }
#else
    vdAssert(count == 0);
#endif
#endif
}
Esempio n. 6
0
File: image.cpp Progetto: ICRAR/void
vd::status
ImageOutput::WriteScanLine(
	vd::i32 y, vd::i32 z,
	const PixelBuffer8u& pixels)
{
	OiioImageOutput* output = reinterpret_cast<OiioImageOutput*>(m_Handle);
	vdAssert(output != NULL);

	if(!output->write_scanline(y, z, OiioTypeDesc::UINT8, pixels.Data))
	{
		vdLogWarning("Failed to write scanline [%d %d] to image '%s'!", y, z, m_Location.c_str());
		return Status::Code::WriteError;
	}

	return Status::Code::Success;
}
Esempio n. 7
0
File: image.cpp Progetto: ICRAR/void
vd::status
ImageOutput::Write(
	ImageBuffer32f& pixels)
{
	OiioImageOutput* output = reinterpret_cast<OiioImageOutput*>(m_Handle);
	vdAssert(output != NULL);

	if(!output->write_image(OiioTypeDesc::FLOAT, pixels.Data))
	{
		vdLogWarning("Failed to load image from file '%s'!", m_Location.c_str());
		return Status::Code::ReadError;
	}

	vdLogInfo("Loaded image %d x %d (%d channels - 32 bit float) F32 from '%s'!", 
		m_Format.Width, m_Format.Height, m_Format.Channels.Count, m_Location.c_str());	

	return Status::Code::Success;
}
Esempio n. 8
0
File: image.cpp Progetto: ICRAR/void
vd::status
ImageOutput::Write(
	ImageBuffer8u& pixels)
{
	OiioImageOutput* output = reinterpret_cast<OiioImageOutput*>(m_Handle);
	vdAssert(output != NULL);
	
	if(!output->write_image(OiioTypeDesc::UINT8, pixels.Data))
	{
		vdLogWarning("Failed to write image to '%s'!", m_Location.c_str());
		return Status::Code::ReadError;
	}

	vdLogInfo("Wrote image %d x %d (%d channels - 8-bit unsigned) from '%s'!", 
		m_Format.Width, m_Format.Height, m_Format.Channels.Count, m_Location.c_str());	

	return Status::Code::Success;
}
Esempio n. 9
0
File: image.cpp Progetto: ICRAR/void
vd::status
ImageInput::Read(
	ImageBuffer8u& pixels)
{
	OiioImageInput* input = reinterpret_cast<OiioImageInput*>(m_Handle);
	vdAssert(input != NULL);
	
	pixels.Setup(m_Format);
	
	if(!input->read_image(OiioTypeDesc::UINT8, pixels.Data))
	{
		vdLogWarning("Failed to load image from file '%s'!", m_Location.c_str());
		return Status::Code::ReadError;
	}

	vdLogInfo("Loaded image %d x %d (%d channels - 8-bit unsigned) from '%s'!", 
		m_Format.Width, m_Format.Height, m_Format.Channels.Count, m_Location.c_str());	

	return Status::Code::Success;
}
Esempio n. 10
0
void
Geometry::Unbind()
{
    vdAssert(m_Data.Usage > 0);
    m_Data.Usage--;
}