示例#1
0
void *
AttributeValues::getProp(unsigned int prop, Enums::DataType type) {

	void *val;

	switch (type) {

		case Enums::ENUM:
			if (m_EnumProps.count(prop) == 0) {
				val = m_Attribs->getDefault(prop, type);
				if (val != NULL)
					m_EnumProps[prop] = *(int *)val;
				else { // life goes on ... except in debug mode
					assert(false && "Accessing undefined attribute of type ENUM");
					SLOG("Accessing undefined attribute of type ENUM - This should never occur");
					m_EnumProps[prop] = 0;
				}
			}
			return(&(m_EnumProps[prop]));
			break;
		case Enums::INT:
			if (m_IntProps.count(prop) == 0) {
				val = m_Attribs->getDefault(prop, type);
				if (val != NULL)
					m_IntProps[prop] = *(int *)val;
				else { // life goes on ... except in debug mode
					assert(false && "Accessing undefined attribute of type INT");
					SLOG("Accessing undefined attribute of type INT - This should never occur");
					m_IntProps[prop] = 0;
				}
			}
			return(&(m_IntProps[prop]));
			break;
		case Enums::IVEC2:
			if (m_Int2Props.count(prop) == 0) {
				val = m_Attribs->getDefault(prop, type);
				if (val != NULL)	
					m_Int2Props[prop] = *(ivec2 *)val;
				else { // life goes on ... except in debug mode
					assert(false && "Accessing undefined attribute of type IVEC2");
					SLOG("Accessing undefined attribute of type IVEC2 - This should never occur");
					m_Int2Props[prop] = 0;
				}
			}
			return(&(m_Int2Props[prop]));
			break;
		case Enums::UINT:
			if (m_UIntProps.count(prop) == 0) {
				val = m_Attribs->getDefault(prop, type);
				if (val != NULL)
					m_UIntProps[prop] = *(unsigned int *)val;
				else { // life goes on ... except in debug mode
					assert(false && "Accessing undefined attribute of type UINT");
					SLOG("Accessing undefined attribute of type UINT - This should never occur");
					m_UIntProps[prop] = 0;
				}
			}
			return(&(m_UIntProps[prop]));
			break;
		case Enums::UIVEC2:
			if (m_UInt2Props.count(prop) == 0) {
				val = m_Attribs->getDefault(prop, type);
				if (val != NULL)
					m_UInt2Props[prop] = *(uivec2 *)val;
				else { // life goes on ... except in debug mode
					assert(false && "Accessing undefined attribute of type UINT2");
					SLOG("Accessing undefined attribute of type UINT2 - This should never occur");
					m_UInt2Props[prop] = uivec2(0);
				}
			}
			return(&(m_UInt3Props[prop]));
			break;
		case Enums::UIVEC3:
			if (m_UInt3Props.count(prop) == 0) {
				val = m_Attribs->getDefault(prop, type);
				if (val != NULL)
					m_UInt3Props[prop] = *(uivec3 *)val;
				else { // life goes on ... except in debug mode
					assert(false && "Accessing undefined attribute of type UINT3");
					SLOG("Accessing undefined attribute of type UINT3 - This should never occur");
					m_UInt3Props[prop] = uivec3(0);
				}
			}
			return(&(m_UInt3Props[prop]));
			break;
		case Enums::BOOL:
			if (m_BoolProps.count(prop) == 0) {
				val = m_Attribs->getDefault(prop, type);
				if (val != NULL)
					m_BoolProps[prop] = *(bool *)val;
				else { // life goes on ... except in debug mode
					assert(false && "Accessing undefined attribute of type BOOL");
					SLOG("Accessing undefined attribute of type BOOL - This should never occur");
					m_BoolProps[prop] = 0;
				}
			}
			return(&(m_BoolProps[prop]));
			break;
		case Enums::BVEC4:
			if (m_Bool4Props.count(prop) == 0) {
				val = m_Attribs->getDefault(prop, type);
				if (val != NULL)
					m_Bool4Props[prop] = *(bvec4 *)val;
				else { // life goes on ... except in debug mode
					assert(false && "Accessing undefined attribute of type BVEC4");
					SLOG("Accessing undefined attribute of type BVEC4 - This should never occur");
					m_Bool4Props[prop] = 0;
				}
			}
			return(&(m_Bool4Props[prop]));
			break;
		case Enums::FLOAT:
			if (m_FloatProps.count(prop) == 0) {
				val = m_Attribs->getDefault(prop, type);
				if (val != NULL)
					m_FloatProps[prop] = *(float *)val;
				else { // life goes on ... except in debug mode
					assert(false && "Accessing undefined user attribute of type FLOAT");
					SLOG("Accessing undefined user attribute of type FLOAT - This should never occur");
					m_FloatProps[prop] = 0;
				}
			}
			return(&(m_FloatProps[prop]));
			break;
		case Enums::VEC4:
			if (m_Float4Props.count(prop) == 0) {
				val = m_Attribs->getDefault(prop, type);
				if (val != NULL)
					m_Float4Props[prop] = *(vec4 *)val;
				else { // life goes on ... except in debug mode
					assert(false && "Accessing undefined user attribute of type VEC4");
					SLOG("Accessing undefined user attribute of type VEC4 - This should never occur");
					m_Float4Props[prop] = vec4(0.0f);
				}
			}
			return(&(m_Float4Props[prop]));
			break;
		case Enums::VEC3:
			if (m_Float3Props.count(prop) == 0) {
				val = m_Attribs->getDefault(prop, type);
				if (val != NULL)
					m_Float3Props[prop] = *(vec3 *)val;
				else { // life goes on ... except in debug mode
					assert(false && "Accessing undefined user attribute of type VEC3");
					SLOG("Accessing undefined user attribute of type VEC3 - This should never occur");
					m_Float3Props[prop] = vec3(0.0f);
				}
			}
			return(&(m_Float3Props[prop]));
			break;
		case Enums::VEC2:
			if (m_Float2Props.count(prop) == 0) {
				val = m_Attribs->getDefault(prop, type);
				if (val != NULL)
					m_Float2Props[prop] = *(vec2 *)val;
				else { // life goes on ... except in debug mode
					assert(false && "Accessing undefined user attribute of type VEC2");
					SLOG("Accessing undefined user attribute of type VEC2 - This should never occur");
					m_Float2Props[prop] = vec2(0.0f);
				}
			}
			return(&(m_Float2Props[prop]));
			break;
		case Enums::MAT4:
			if (m_Mat4Props.count(prop) == 0) {
				val = m_Attribs->getDefault(prop, type);
				if (val != NULL)
					m_Mat4Props[prop] = *(mat4 *)val;
				else { // life goes on ... except in debug mode
					assert(false && "Accessing undefined user attribute of type MAT4");
					SLOG("Accessing undefined user attribute of type MAT4 - This should never occur");
					m_Mat4Props[prop] = mat4();
				}
			}
			return(&(m_Mat4Props[prop]));
			break;
		case Enums::MAT3:
			if (m_Mat3Props.count(prop) == 0) {
				val = m_Attribs->getDefault(prop, type);
				if (val != NULL)
					m_Mat3Props[prop] = *(mat3 *)val;
				else { // life goes on ... except in debug mode
					assert(false && "Accessing undefined user attribute of type MAT3");
					SLOG("Accessing undefined user attribute of type MAT3 - This should never occur");
					m_Mat3Props[prop] = mat3();
				}
			}
			return(&(m_Mat3Props[prop]));
			break;
		default:
			assert(false && "Missing Data Type in class attributeValues");
			return NULL;
	}
};
void RendererWidget::resizeEvent(QResizeEvent* ev)
{
    if(_renderer)
        _renderer->updateSize(uivec2(ev->size().width(), ev->size().height()));
}