HOOPS INTRODUCE

来源:互联网 发布:单片机寄存器是什么 编辑:程序博客网 时间:2024/05/17 23:26

1.HOOPS/3dAF( 3D Application Framework)
The HOOPS 3D Application Framework (HOOPS/3dAF) consists of an integrated suite of toolkits that are used to build commercial 3D graphics applications.  HOOPS/3dAF provides a flexible architectural foundation based on a series of modular application components, which enable the rapid development and maintenance of high-performance design, visualization, and engineering packages. HOOPS/3dAF maintains platform independence within each component, providing comprehensive cross-platform solutions on Windows, UNIX, LINUX, Mac OS X and the Internet.
The HOOPS 3D Application Framework consists of the following components:
n         HOOPS/3dGS - HOOPS 3D Graphics System
n         HOOPS/Stream - The HOOPS Stream Toolkit
n         HOOPS Model/View/Operator (MVO) Class Library
n         HOOPS/GUI - Graphical User Interface Modules
n         HOOPS/GMB - Geometric Modeler Bridges
 
The diagram below illustrates how these components are connected to each other and how user generated events flow from the GUI Toolkit to the HOOPS/3dAF.

The HOOPS 3D Application Framework
User-generated events are collected by a GUI Tool's event queue. The HOOPS/GUI integration module monitors the event queue and dispatches appropriate events to either the HOOPS/MVO objects, HOOPS/Net client objects, or directly to HOOPS/3dGS. The HOOPS/MVO application objects in turn engage the API of either the geometric modeler, HOOPS/GMB, HOOPS/Net, or HOOPS/3dGS itself to interact with the data stored in each component.
 
2。HOOPS/GUI - Graphical User Interface Modules
The Graphical User Interface Integrations encapsulate the work needed to connect the HOOPS/3dAF to several different Graphical User Interface (GUI) toolkits. Currently HOOPS/GUI modules exist for:  
Ø         Microsoft Foundation Classes (MFC) on Windows 
Ø         Qt Toolkit for cross platform GUI development
Ø         ActiveX Control Classes on Windows 
Ø         MOTIF Toolkit on UNIX 
 
3.HOOPS/ACIS桥(HOOPS/GMB)
The HOOPS/ACIS Bridge encapsulates the work needed to connect ACIS modeler from Spatial to the HOOPS/3dGS.
The bridge provides an API for controlling the manner in which ACIS' geometric tessellation is mapped to HOOPS primitives, and for finding exactly which HOOPS segment entity corresponds to which ACIS entity and vice versa. The HOOPS/ACIS Bridge is supplied as a dynamic linked library (dll) with an exposed API.
Building a two-way connection between ACIS and the HOOPS/3dGS involves accessing the geometric data in ACIS and mapping it the appropriate set of geometric primitives in HOOPS
A class that implementsIEntityConverter performs the conversion of ACIS ENTITYs to HOOPS segments
The HOOPS/ACIS Bridge routine HA_Render_Entities will initiate the flow of geometric information from ACIS to the HOOPS/3dGS. The HA_Render_Entities routine accepts a list of ACIS entities and then calls the registered IEntityConverter class to convert the ACIS ENTITYs to HOOPS segments.
 
Creating and Rendering ACIS Entities
Rendering ACIS entities is performed by calling HA_Render_Entity or HA_Render_Entities.
Defining ACIS Geometry
A sphere, along with many other predefined ACIS objects, is represented by a BODY entity, and is created via the routine:
<outcome>= api_make_sphere(<radius>, <sphere_body>); 

The following code demonstrates how to create an ACIS sphere. Note that it calls HA_Render_Entity.
 
// create an acis sphere and return the sphere's body id
BODY* HOpCreateSolidSphere::CreateSolidSphere(HPoint & center, float radius)
{
 BODY* sphere_body;
vector translate_vector;
transf delta_transf;
outcome o;
translate_vector.set_x(center.x);
translate_vector.set_y(center.y);
translate_vector.set_z(center.z);
delta_transf = translate_transf(translate_vector);
o = api_make_sphere(radius, sphere_body);
o = api_transform_entity(sphere_body, delta_transf);
assert(o.ok());
// before rendering bodies, check if this view is in 'merge faces'
// mode or not, and ensure that the rendering option is set
// accordingly.  This is necessary because the HOOPS/GM Rendering
// Options are procedural; they set the current state of the bridge,
// and we need to make sure that all parts in each view object are
// rendered in a consistent mode
if (((HSolidView*)GetView())->GetOptimizations())
 HA_Set_Rendering_Options("merge faces");
else
 HA_Set_Rendering_Options("no merge faces");
// now put it in the HOOPS database
HA_Render_Entity((ENTITY*)sphere_body);
((HSolidModel*)m_pView->GetModel())->AddAcisEntity(sphere_body);
return sphere_body;
}
Inserting ACIS Geometry into the HOOPS database:
//Read Sat file
// strPartFilePath为sat文件路径名
ENTITY_LIST entList;
CFile SatFile = fopen (strPartFilePath, "rt");
outcome oRes = api_restore_entity_list(satFile, TRUE, entList);   
//将多余的边去除,以达到使圆柱侧面为一个完整周期曲面的目的
entList.init();
ENTITY* entity = entList.next();
while(entity != NULL)
{
    oRes = api_clean_entity(entity);
    entity = entList.next();
}
entList.init();
 
// ACIS entity map to HOOPS segment
HC_Open_Segment_By_Key(key);
    entList ->init();
    ENTITY* ent =pList->next();
    while(ent != NULL)
   {
        HA_Render_Entity(ent);
        ent = pList->next();
    }
HC_Close_Segment();
 
 
//HA_Render_Entity()函数内部调用上面提到的IEntityConverter接口:
HC_KEY HA_Render_Entity(ENTITY* entity, const char* pattern)
{
extern IEntityConverter *s_pIEntityConverter;
ENTITY *owner = NULL;
 。。。。。。
api_get_owner( entity, owner );
pattern = s_RenderingOptions.GetPattern();
key=s_pIEntityConverter->ConvertEntity(owner,s_RenderingOptions,map,pattern)
。。。。。。
};
 
// delete the ACIS body
void HSolidModel::DeleteAcisEntity( ENTITY* entity)
{
   ENTITY_LIST elist;
   elist.add(entity);
   HA_Delete_Entity_Geometry(elist);
    api_del_entity(entity);
}
 
The HOOPS/ACIS Bridge maps the tessellation of all ACIS entities to HOOPS geometric primitives, inserting zero or more new HOOPS geometric primitives into the HOOPS database for each ACIS entity encountered.  While each ACIS entity uses a pointer for access, HOOPS entities have “keys” that are long integers and are passed to routines when accessing the entity. The HOOPS/ACIS Bridge routines HA_Compute_Entity_Pointer and HA_Compute_Geometry_Keys can be used for converting ACIS pointers to HOOPS keys and vice versa.
 
Operating on ACIS Entities
When performing operations that modify ACIS entities, it is necessary to keep the HOOPS representation of the model synchronized with its ACIS representation. Because such operations are typically initiated by selecting (hit testing) HOOPS geometric objects, it is necessary to determine which ACIS entity(s) correspond with the selected HOOPS entities, and vice versa. The HOOPS/ACIS Integration includes routines that support this requirement.
HOOPS geometric entities are identified by a HOOPS 'key'.  Recall that ACIS entities are referred to by an ACIS pointer. Given a HOOPS key, the HA_Compute_Entity_Pointer function will return the ACIS pointer for the ACIS entity associated with that key. Conversely, given an ACIS pointer, the HA_Compute_Geometry_Keys function will return all the HOOPS keys for the tessellated geometry or the HOOPS segment associated with the ACIS entity. (Recall that an ACIS entity might be represented by more than one HOOPS geometric entity.)
 
Accessing an ACIS Entity
Selection on the HOOPS scene returns the key(s) of HOOPS geometry, requiring us to find the ACIS entity that is associated with the selected HOOPS geometry. If we wanted to access the ACIS 'body' entity given the key of a selected HOOPS geometric primitive, we would call:
BODY*  entity = (BODY*)HA_Compute_Entity_Pointer(key, BODY_TYPE); 

We can now use the pointer of the ACIS entity to perform ACIS operations, or to access the HOOPS geometric primitives that represent the ACIS entity.
 
 
4.HOOPS/MVO (Model/View/Operator)
Model : Application data 
View : Representations of the application data 
Operator : Algorithms that operate on the application data
The user of the application operates on the model via the views of the model. Views are designed specifically to facilitate a given model interaction such as data creation or editing. Views can "look at" multiple models and models can "be seen" by multiple views (a many to many mapping). Operators are associated with views.
In HOOPS, 3D objects are organized into segments containing geometry, attributes and sub-segments. For each application, the 3D model maps to some section of the HOOPS segment tree, typically in the Include Library. Views are mapped to HOOPS driver instance segments with camera and window attributes. The model is either directly built under the driver instance segment or included from another spot in the segment tree. This relationship of HOOPS model to HOOPS views is generic and applicable to most applications built with HOOPS. 
Operators consist of the application code that manipulates the application data. When building HOOPS-MVO applications, the operators use the HOOPS API, along with other component or application-specific APIs, to manipulate the data stored in both HOOPS and application-specific data structures.
The HOOPS/MVO Classes provide a HOOPS-specific implementation of the  model/view/operator paradigm, which may be directly incorporated into an application and extended.

MVO's HOOPS 3dGS Segment Structure
The class library builds higher level objects for the model and view out of HOOPS segment structures. The HBaseModel object is built out of the include library and the HBaseView object is built out of HOOPS driver segment instances. View objects also build an initial segment structure for managing the inclusion of model objects, interacting with user input, lighting of the scene, etc...
 
5.HOOPS/3dGS(3D Graphics System )
HOOPS/3dGS provides the algorithms for creating, editing, manipulating, and querying the graphics information stored in the database
The HOOPS/3dGS Graphics System, illustrated in Figure 1, consists of 2 major subcomponents: a graphical object database called the HOOPS/3dGS Segment Tree, and a rendering pipeline called the HOOPS/3dGS Structured Device Interface.
The Object Database
The HOOPS/3dGS database stores graphical data in objects called "segments". Think of a segment as a container for geometry and attributes that describe how the geometry is to be drawn..
The HOOPS/3dGS graphics database stores graphics scenes as a hierarchy of segments, which lends itself naturally to organizing graphics information.  In terms of object-oriented programming, think of a segment as an object.

6.HOOPS/Stream
HOOPS/Stream is a set of platform and GUI-independent C++ classes that provide support for creating and reading HOOPS Stream Files (HSF's) or data streams containing 2D & 3D scene-graph objects, attributes, and any kind of specialized application-specific data.
HOOPS/Stream's open architecture allows developers to create and read custom, stream-enabled HSF files that are tailored to a particular application's needs. Its flexibility of design enables the creation of an endless variety of streaming formats, file extensions, file interaction strategies (including client/server interaction), data transfer techniques, and more...all with advanced data compression and full object and attribute support.
HOOPS/Stream is independent from other HOOPS modules, in that its usage does not require the application's architecture to be based on HOOPS/3dAF. Any application using a proprietary scene graph, as well as those that use HOOPS/3dAF, can implement HOOPS/Stream.


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/qmroom/archive/2008/12/22/3580370.aspx

原创粉丝点击