Example #1
0
void AddFaceWithTexture(scene::Node& brush, vec3_t va, vec3_t vb, vec3_t vc, const char* texture, bool detail)
{
	_QERFaceData faceData;
	FillDefaultTexture(&faceData, va, vb, vc, texture);
	if(detail)
		faceData.contents |= FACE_DETAIL;
  GlobalBrushCreator().Brush_addFace(brush, faceData);
}
Example #2
0
void AddFaceWithTextureScaled(scene::Node* brush, vec3_t va, vec3_t vb, vec3_t vc,
                              const char* texture, bool bVertScale, bool bHorScale,
                              float minX, float minY, float maxX, float maxY)
{
    qtexture_t* pqtTexInfo;

    // TTimo: there used to be a call to pfnHasShader here
    //   this was not necessary. In Radiant everything is shader.
    //   If a texture doesn't have a shader script, a default shader object is used.
    // The IShader object was leaking also
    // collect texture info: sizes, etc
    IShader* i = QERApp_Shader_ForName(texture);
    pqtTexInfo = i->getTexture();	// shader width/height doesn't come out properly

    if(pqtTexInfo)
    {
        float scale[2] = {0.5f, 0.5f};
        float shift[2] = {0, 0};

        if(bHorScale)
        {
            int texWidth = pqtTexInfo->width;
            float width = maxX - minX;

            scale[0] = width/texWidth;
            shift[0] = -(float)((int)maxX%(int)width)/scale[0];
        }

        if(bVertScale)
        {
            int texHeight = pqtTexInfo->height;
            float height = maxY - minY;

            scale[1] = height/texHeight;
            shift[1] = (float)((int)minY%(int)height)/scale[1];
        }

        _QERFaceData addFace;
        FillDefaultTexture(&addFace, va, vb, vc, texture);
        addFace.m_texdef.scale[0] = scale[0];
        addFace.m_texdef.scale[1] = scale[1];
        addFace.m_texdef.shift[0] = shift[0];
        addFace.m_texdef.shift[1] = shift[1];

#if 0
        brush->m_brush->addPlane(addFace.m_p0, addFace.m_p1, addFace.m_p2, addFace.m_texdef);
#endif
    }
    else
    {
        // shouldn't even get here, as default missing texture should be returned if
        // texture doesn't exist, but just in case
        AddFaceWithTexture(brush, va, vb, vc, texture, FALSE);
        Sys_ERROR("BobToolz::Invalid Texture Name-> %s", texture);
    }
    // the IShader is not kept referenced, DecRef it
    i->DecRef();
}
Example #3
0
void AddFaceWithTexture( brush_t* brush, vec3_t va, vec3_t vb, vec3_t vc, const char* texture, bool detail ){
	_QERFaceData faceData;
	FillDefaultTexture( &faceData, va, vb, vc, texture );
	if ( detail ) {
		faceData.m_nContents |= FACE_DETAIL;
	}

	g_FuncTable.m_pfnAddFaceData( brush, &faceData );
}
Example #4
0
void AddFaceWithTexture(scene::Node* brush, vec3_t va, vec3_t vb, vec3_t vc, const char* texture, bool detail)
{
    _QERFaceData faceData;
    FillDefaultTexture(&faceData, va, vb, vc, texture);
    if(detail)
        faceData.m_texdef.contents |= FACE_DETAIL;
#if 0
    brush->m_brush->addPlane(faceData.m_p0, faceData.m_p1, faceData.m_p2, faceData.m_texdef);
#endif
}
Example #5
0
void AddFaceWithTextureScaled(scene::Node& brush, vec3_t va, vec3_t vb, vec3_t vc, 
							  const char* texture, bool bVertScale, bool bHorScale, 
							  float minX, float minY, float maxX, float maxY)
{
	qtexture_t* pqtTexInfo;

  // TTimo: there used to be a call to pfnHasShader here
  //   this was not necessary. In Radiant everything is shader.
  //   If a texture doesn't have a shader script, a default shader object is used.
  // The IShader object was leaking also
	// collect texture info: sizes, etc
	IShader* i = GlobalShaderSystem().getShaderForName(texture);
  pqtTexInfo = i->getTexture();	// shader width/height doesn't come out properly

	if(pqtTexInfo)
	{
		float scale[2] = {0.5f, 0.5f};
		float shift[2] = {0, 0};

		if(bHorScale)
		{
			float width = maxX - minX;

			scale[0] = width/pqtTexInfo->width;
			shift[0] = -(float)((int)maxX%(int)width)/scale[0];
		}

		if(bVertScale)
		{
			float height = maxY - minY;

			scale[1] = height/pqtTexInfo->height;
			shift[1] = (float)((int)minY%(int)height)/scale[1];
		}

		_QERFaceData addFace;
		FillDefaultTexture(&addFace, va, vb, vc, texture);
		addFace.m_texdef.scale[0] = scale[0];
		addFace.m_texdef.scale[1] = scale[1];
		addFace.m_texdef.shift[0] = shift[0];
		addFace.m_texdef.shift[1] = shift[1];

    GlobalBrushCreator().Brush_addFace(brush, addFace);
	}
	else
	{
		// shouldn't even get here, as default missing texture should be returned if
		// texture doesn't exist, but just in case
		AddFaceWithTexture(brush, va, vb, vc, texture, false);
		globalErrorStream() << "BobToolz::Invalid Texture Name-> " << texture;
	}
  // the IShader is not kept referenced, DecRef it
  i->DecRef();
}