Over 10 Million Study Resources Now at Your Fingertips

Download as :
Rating : ⭐⭐⭐⭐⭐
Price : $10.99
Pages: 2

Set the visibility boolean the original polygon false

If the surface we have been passed has the SCOMPONENT_BLENDMODES flag set in its Components bitset, it means it has blend modes defined for it that can be found in the BLEND_MODE structure. This structure is defined in the file libIWF.h as shown below.

Excerpt from libIWF.h – Part of the IWF SDK

Notice that when we extract the blend modes from the surface in the above code, we extract from element zero in the surface’s blend modes array. This is because the IWF file will store blend modes for each channel. Since we are not multi-texturing at the moment, we are only interested in fetching the blend modes for the first channel (the first and only texture).

Now that we have the blend modes for our polygon, we will test to see if either the source or destination blend modes are non-zero. If they are, it means that this surface should be alpha blended. In this case, we make a copy of the CPolygon (via a copy constructor) and register it with the alpha tree. The reason we create a copy of the CPolygon and do not just pass its pointer straight into the BSP tree is that we will also pass this polygon into spatial tree as well. We cannot use the same pointer for both trees because the BSP tree will most likely split the polygon during the build process, thus removing the original polygon are replacing it with two new child polygons. If the BSP tree deletes the polygon that also has a pointer stored in ISpatialTree, we are going to have significant problems. Thus, we make a copy and give each tree its own version to work with as it pleases.

// Ensure that when it's added to the spatial tree, that it's not used for rendering pPolygon->m_bVisible = false;



// Success!
return true;

During the loading process, this function will be called for every static polygon loaded from the IWF file. By ‘static’ we mean polygon data stored inside the IWF file (i.e., it is not called for polygons contained in external reference objects) which is defined in world space. All of these polygons will have been registered with the spatial tree and any surfaces that have been flagged by the artist as being alpha surfaces will be contained in the alpha (BSP node) tree. As we have seen, after all polygons have been processed, program flow returns to the CScene::LoadSceneFromIWF function where both trees are then instructed to compile their data.



How It Works
Login account
Login Your Account
Add to cart
Add to Cart
Make payment
Document download
Download File
Uploaded by :
Page 1 Preview
set the visibility boolean the original polygon fa
Sell Your Old Documents & Earn Wallet Balance