hhoopstestview.cpp

来自「使用HOOPS库开发的一个教学演示工具。」· C++ 代码 · 共 104 行

CPP
104
字号
// HhoopstestView.cpp : implementation of the HhoopstestView class// // Standard includes#include "StdAfx.h"#include "Resource.h"#include <assert.h>#include <math.h>#include "hc.h"#include "HhoopstestView.h"#include "HhoopstestModel.h"#include "HhoopstestSelectionSet.h"#include "HSharedKey.h"HhoopstestView::HhoopstestView(HBaseModel *model,    const char * 		alias,	    const char *		driver_type,    const char *		instance_name,    void *				window_handle,    void *				colormap) : HBaseView(model, alias, driver_type, instance_name, window_handle, colormap){}HhoopstestView::~HhoopstestView(){}// app-specific init functionvoid HhoopstestView::Init(){	// call base's init function first to get the default HOOPS hierarchy for the view	HBaseView::Init();	// create our app-specific Selection object and initialize	m_pSelection = new HhoopstestSelectionSet(this);    m_pSelection->Init();	// TODO: Add your initialization here}//	Override FitWorld to always fire CameraPositionChanged//	with emit_message so that the clients get in syncvoid HhoopstestView::FitWorld(HPoint * center_out){	HBaseView::FitWorld(center_out);	CameraPositionChanged( true, GetSmoothTransition());}// Override this. We might be in body level selection // while the master client might want us to select a face. // call my_sel->SelectFromMessage rather than my_sel->Selectvoid HhoopstestView::SelectFromMessage(const char *in_data, unsigned int data_length){    char data[8192];	int isSelect = false;	long ident = 0;	HC_KEY key = 0;    memcpy(data, in_data, data_length);    data[data_length] = '\0';    sscanf(data, "%d %d", &isSelect, &ident);	if (m_pSharedKey && (key = m_pSharedKey->GetKeyFromIdent(ident)))	{		HhoopstestSelectionSet* my_sel = (HhoopstestSelectionSet*) GetSelection();		assert( my_sel );		if (isSelect)			my_sel->SelectFromMessage(key, "", INVALID_KEY, INVALID_KEY);		else			my_sel->DeSelectFromMessage(key);	}}//	Override the base Flush to remove any solid modeler objects presentvoid HhoopstestView::Flush(bool emit_message){	HhoopstestModel* model = (HhoopstestModel*) GetModel();	if( model )		model->DeleteAllEntities();	HBaseView::Flush(emit_message);}void HhoopstestView::FlushFromMessage(const char *in_data, unsigned int data_length){	HhoopstestModel* model = (HhoopstestModel*) GetModel();	if( model )		model->DeleteAllEntities();	HBaseView::FlushFromMessage(in_data, data_length);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?