! struct operator Reload

Source: Internet
Author: User

struct T3dobject//object Information structure body
{
int numofverts; Number of vertices in the model
The number of polygons in the int numoffaces;//model
The number of texture coordinates in the int numtexvertex;//model
int materialid; Texture ID
Whether bool bhastexture;//has texture mapping
BOOL bvisible;//object is visible, default is visible
Char strname[255];//the name of the object
FPoint3 vertex of *pverts;//object
Normal vector of FPoint3 *pnormals;//vertices
FPoint2 *ptexverts;//Texture UV coordinates
Tface Polygon information for *pfaces;//objects
FPoint3 normal of *pfacenormals;//face

Overloading the t3dobject operator
t3dobject& operator= (t3dobject& value)
{
Numofverts = Value.numofverts; Number of vertices in the model
numoffaces = number of polygons in the value.numoffaces;//model
Numtexvertex = number of texture coordinates in the value.numtexvertex;//model
Materialid = Value.materialid; Texture ID
Bhastexture = value.bhastexture;//Whether there is a texture map
Bvisible = value.bvisible;//object is visible, default is visible
Char strname[255];//the name of the object
Pverts = vertex of value.pverts;//object
Pnormals = Normal vector of value.pnormals;//vertices
Ptexverts = value.ptexverts;//Texture UV coordinates
Pfaces = Polygon information for value.pfaces;//objects
Pfacenormals = Normals of value.pfacenormals;//faces

return *this;
}
};

When a struct contains a struct, the assignment is complex and prone to problems, so it's best to use a pointer to pass it.

! struct operator Reload

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.