Beispiel #1
0
void DPatch::LoadFromBrush_t(brush_t* brush)
{
	QER_brush = brush;
	QER_patch = brush->pPatch;

	SetTexture(QER_patch->pShader->getName());

	for(int x = 0; x < QER_patch->width; x++)
		for(int y = 0; y < QER_patch->height; y++)
			CopyDrawVert(&QER_patch->ctrl[x][y], &points[x][y]);

	width = QER_patch->width;
	height = QER_patch->height;
}
Beispiel #2
0
void DPatch::BuildInRadiant(void* entity)
{
	int nIndex = g_FuncTable.m_pfnCreatePatchHandle();
    //$ FIXME: m_pfnGetPatchHandle
	patchMesh_t* pm = g_FuncTable.m_pfnGetPatchData(nIndex);

	pm->height = height;
	pm->width = width;

	for(int x = 0; x < width; x++)
		for(int y = 0; y < height; y++)
			CopyDrawVert(&points[x][y], &pm->ctrl[x][y]);

	QER_patch = pm;

/*	if(entity)
	{
//		strcpy(pm->d_texture->name, texture);

		brush_t* brush = (brush_t*)g_FuncTable.m_pfnCreateBrushHandle();
		brush->patchBrush = TRUE;
		brush->pPatch = pm;		

		pm->pSymbiot = brush;
		pm->bSelected = false;
		pm->bOverlay = false;	// bleh, f*cks up, just have to wait for a proper function
		pm->bDirty = true;		// or get my own patch out....
		pm->nListID = -1;

		g_FuncTable.m_pfnCommitBrushHandleToEntity(brush, entity);
	}
	else*/	// patch to entity just plain dont work atm

  if(entity)
    g_FuncTable.m_pfnCommitPatchHandleToEntity(nIndex, pm, texture, entity);
  else
		g_FuncTable.m_pfnCommitPatchHandleToMap(nIndex, pm, texture);

	QER_brush = pm->pSymbiot;
}
Beispiel #3
0
void DPatch::BuildInRadiant( scene::Node* entity ){
	NodeSmartReference patch( GlobalPatchCreator().createPatch() );

	scene::Node& parent = entity != 0 ? *entity : GlobalRadiant().getMapWorldEntity();
	Node_getTraversable( parent )->insert( patch );

	GlobalPatchCreator().Patch_setShader( patch, texture );
	GlobalPatchCreator().Patch_resize( patch, height, width );
	PatchControlMatrix matrix = GlobalPatchCreator().Patch_getControlPoints( patch );
	for ( int x = 0; x < width; x++ )
	{
		for ( int y = 0; y < height; y++ )
		{
			PatchControl& p = matrix( x, y );
			p.m_vertex[0] = points[x][y].xyz[0];
			p.m_vertex[1] = points[x][y].xyz[1];
			p.m_vertex[2] = points[x][y].xyz[2];
			p.m_texcoord[0] = points[x][y].st[0];
			p.m_texcoord[1] = points[x][y].st[1];
		}
	}
	GlobalPatchCreator().Patch_controlPointsChanged( patch );

	QER_entity = entity;
	QER_brush = patch.get_pointer();


#if 0
	int nIndex = g_FuncTable.m_pfnCreatePatchHandle();
	//$ FIXME: m_pfnGetPatchHandle
	patchMesh_t* pm = g_FuncTable.m_pfnGetPatchData( nIndex );

	b->patchBrush = true;
	b->pPatch = Patch_Alloc();
	b->pPatch->setDims( width,height );

	for ( int x = 0; x < width; x++ )
		for ( int y = 0; y < height; y++ )
			CopyDrawVert( &points[x][y], &pm->ctrl[x][y] );

/*	if(entity)
    {
   //		strcpy(pm->d_texture->name, texture);

        brush_t* brush = (brush_t*)g_FuncTable.m_pfnCreateBrushHandle();
        brush->patchBrush = true;
        brush->pPatch = pm;

        pm->pSymbiot = brush;
        pm->bSelected = false;
        pm->bOverlay = false;	// bleh, f*cks up, just have to wait for a proper function
        pm->bDirty = true;		// or get my own patch out....
        pm->nListID = -1;

        g_FuncTable.m_pfnCommitBrushHandleToEntity(brush, entity);
    }
    else*/                                                                                                                                                                                                                                                                                                                                                                                                                                                                // patch to entity just plain dont work atm

	if ( entity ) {
		g_FuncTable.m_pfnCommitPatchHandleToEntity( nIndex, pm, texture, entity );
	}
	else{
		g_FuncTable.m_pfnCommitPatchHandleToMap( nIndex, pm, texture );
	}

	QER_brush = pm->pSymbiot;
#endif
}