Click here to Skip to main content
15,888,189 members
Articles / Desktop Programming / MFC

VRMLTest - Full VRML 1.x parser and partial viewer

Rate me:
Please Sign up or sign in to vote.
4.58/5 (9 votes)
6 Feb 2000 129.7K   7.4K   42  
VRML parser and Partial viewer
/**
 * @doc VRMLCanvas EXTERNAL VRML OPENGL CONTROL
 * 
 * @module VRMLCanvas.h - VRML Scene renderer |
 *
 * This file defines the class to render a VRML Scene. 
 * 
 * @update 2000-2-03 | ATL | Example added
 * @update 2000-1-25 | ATL | Fixed material lighting
 * @update 1999-3-16 | ATL | Creation
 *
 * @rem This class only supports rendering of Material, Coordinate3 and IndexedFaceSet 
 * nodes
 * 
 * @ex Given a <c CVRMLCanvas>, to view a <c CVRMLScene> just do |
 * CVRMLScene* pvscn;
 * pvscn = new CVRMLScene();
 * // Load default VRML 1.x node library
 * pvscn->LoadScene("allnodes.wrl");
 * // Load desired VRML file
 * pvscn->
 * // Attach scene to canvas
 * vrcnvCanvas.SetScene(pvscn);
 * // The scene will be deallocated when the
 * // CVRMLCanvas is deleted
 *
 */

#if !defined(AFX_VRMLCANVAS_H__1407BFC3_0A2B_11D3_AA42_F04DDA726F57__INCLUDED_)
#define AFX_VRMLCANVAS_H__1407BFC3_0A2B_11D3_AA42_F04DDA726F57__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "OGLCanvas.h"
#include "VRML.h"

/**
 * @class <c COGLCanvas> wrapper to allow rendering of VRML models
 */
class CVRMLCanvas : public COGLCanvas {
public:
     
//@access Consruction
   /** 
    * @cmember Constructs this canvas
    */
   CVRMLCanvas();
   /**
    * @cmember,mfunc Destructs this canvas, and the <c CVRMLScene> it owns, if any
    * @@rem Call <mf CVRMLCanvas::SetScene> with NULL as parameter if you don't want
    * the <c CVRMLScene> to be destroyed with the canvas.
    */
   virtual ~CVRMLCanvas();

//@access Operations
   /** 
    * @cmember,mfunc Renders a <c CVRMLNode> recursively by rendering the 
    * node itself and its children
    * @@parm Node to render
    */
   void RenderNode(CVRMLNode* pvn); 
   /**
    * @cmember,mfunc Sets the <c CVRMLScene> to render
    * @@parm Scene to set as scene to render. Can be NULL.
    */
   void SetScene(CVRMLScene* pvscn);

//@access Overridables
   /**
    * @cmember,mfunc Partially supports rendering of <c CVRMLScene>s.
    * @@rem By now it only supports wrl files like those found in http://www.rosl.com,
    * that is IndexedFaceSets and Coordinate3 nodes with Material nodes (perhaps nested 
    * with Separators). All other kind of nodes are silently ignored
    */
   virtual void Render();

//@access Public Data Members
   CVRMLScene* m_pvscn;    ///@cmember <c CVRMLScene> Scene to render.
   CMFVec3f* m_pvm3fCoord; ///@cmember Last Coordinate3 node travelled
};

#endif // !defined(AFX_VRMLCANVAS_H__1407BFC3_0A2B_11D3_AA42_F04DDA726F57__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Spain Spain
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions