improved and fixed CreatePlane
This commit is contained in:
parent
a58589f01f
commit
7788459109
@ -78,23 +78,10 @@ namespace hgl
|
||||
*/
|
||||
Primitive *CreatePlaneGrid(RenderResource *db,const VIL *vil,const PlaneGridCreateInfo *pgci);
|
||||
|
||||
struct PlaneCreateInfo
|
||||
{
|
||||
Vector2f tile;
|
||||
|
||||
public:
|
||||
|
||||
PlaneCreateInfo()
|
||||
{
|
||||
tile.x=1.0f;
|
||||
tile.y=1.0f;
|
||||
}
|
||||
};//struct PlaneCreateInfo
|
||||
|
||||
/**
|
||||
* 创建一个平面(三角形)
|
||||
*/
|
||||
Primitive *CreatePlane(RenderResource *db,const VIL *vil,const PlaneCreateInfo *pci);
|
||||
Primitive *CreatePlane(RenderResource *db,const VIL *vil);
|
||||
|
||||
struct CubeCreateInfo
|
||||
{
|
||||
|
@ -212,7 +212,7 @@ namespace hgl
|
||||
return rc.Finish("PlaneGrid");
|
||||
}
|
||||
|
||||
Primitive *CreatePlane(RenderResource *db,const VIL *vil,const PlaneCreateInfo *pci)
|
||||
Primitive *CreatePlane(RenderResource *db,const VIL *vil)
|
||||
{
|
||||
const float xy_vertices [] = { -0.5f,-0.5f,0.0f, +0.5f,-0.5f,0.0f, +0.5f,+0.5f,0.0f, -0.5f,+0.5f,0.0f };
|
||||
float xy_tex_coord[] = { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f };
|
||||
@ -235,19 +235,14 @@ namespace hgl
|
||||
{
|
||||
AutoDelete<VB3f> tangent=rc.AccessVAD<VB3f>(VAN::Tangent);
|
||||
|
||||
tangent->RepeatWrite(xy_tangent,4);
|
||||
if(tangent)tangent->RepeatWrite(xy_tangent,4);
|
||||
}
|
||||
|
||||
{
|
||||
AutoDelete<VB2f> tex_coord=rc.AccessVAD<VB2f>(VAN::TexCoord);
|
||||
|
||||
if(tex_coord)
|
||||
{
|
||||
xy_tex_coord[2]=xy_tex_coord[4]=pci->tile.x;
|
||||
xy_tex_coord[5]=xy_tex_coord[7]=pci->tile.y;
|
||||
|
||||
tex_coord->Write(xy_tex_coord);
|
||||
}
|
||||
tex_coord->Write(xy_tex_coord,4);
|
||||
}
|
||||
|
||||
return rc.Finish("Plane");
|
||||
|
Loading…
x
Reference in New Issue
Block a user