Ejemplo n.º 1
0
/// 정점, 인덱스 버퍼를 생성한다.
HRESULT	ZTerrain::_CreateVIB()
{
 	m_pRscVertexBuffer = cResourceMng::m_pInstance->CreateRscVertexBuffer(m_strNodeName,m_cxDIB*m_czDIB*sizeof(TERRAINVERTEX));
	m_pRscVertexBuffer->AddRef();

 	if (m_pRscVertexBuffer == NULL)
 	{
		_Destroy();
		return E_FAIL;
 	}
	VOID* pVertices;
	pVertices=m_pRscVertexBuffer->Lock(m_pRscVertexBuffer->GetBufferSize(),0);
	if (pVertices == NULL)
	{
		_Destroy();
		return E_FAIL;
	}
	memcpy( pVertices, m_pvHeightMap, m_cxDIB*m_czDIB*sizeof(TERRAINVERTEX) );
	m_pRscVertexBuffer->Unlock();

	m_pRscIndexBuffer = cResourceMng::m_pInstance->CreateRscIndexBuffer(m_strNodeName,(m_cxDIB-1)*(m_czDIB-1)*2 * sizeof(WORD)*3);
	m_pRscIndexBuffer->AddRef();

	if (m_pRscIndexBuffer == NULL)
	{
		_Destroy();
		return E_FAIL;
	}	
    return S_OK;
}
Ejemplo n.º 2
0
void 
__vector__<_Tp, _Alloc>::_M_assign_aux(_ForwardIter __first, _ForwardIter __last,
				   forward_iterator_tag) {
  size_type __len = 0;
  distance(__first, __last, __len);
    
  if (__len > capacity()) {
    iterator __tmp = _M_allocate_and_copy(__len, __first, __last);
    _Destroy(_M_start, _M_finish);
    _M_end_of_storage.deallocate(_M_start, _M_end_of_storage._M_data - _M_start);
    _M_start = __tmp;
    _M_end_of_storage._M_data = _M_finish = _M_start + __len;
  }
  else if (size() >= __len) {
    iterator __new_finish = copy(__first, __last, _M_start);
    _Destroy(__new_finish, _M_finish);
    _M_finish = __new_finish;
  }
  else {
    _ForwardIter __mid = __first;
    advance(__mid, size());
    copy(__first, __mid, _M_start);
    _M_finish = uninitialized_copy(__mid, __last, _M_finish);
  }
}
Ejemplo n.º 3
0
void  __vector__<_Tp, _Alloc>::_M_range_insert(
					   __iterator__ __position,
					   _ForwardIterator __first,
					   _ForwardIterator __last,
					   forward_iterator_tag)
# endif /* MEMBER_TEMPLATES */

# if !( defined ( __STL_MEMBER_TEMPLATES ) &&  defined (__STL_INLINE_MEMBER_TEMPLATES))
{
  if (__first != __last) {
    size_type __n = 0;
    distance(__first, __last, __n);
    if (size_type(_M_end_of_storage._M_data - _M_finish) >= __n) {
      const size_type __elems_after = _M_finish - __position;
      pointer __old_finish = _M_finish;
      if (__elems_after > __n) {
          uninitialized_copy(_M_finish - __n, _M_finish, _M_finish);
          _M_finish += __n;
          copy_backward(__position, __old_finish - __n, __old_finish);
          copy(__first, __last, __position);
      }
      else {
# if (defined ( __STL_MEMBER_TEMPLATES ) && ! defined (__STL_INLINE_MEMBER_TEMPLATES))
          _ForwardIterator __mid = __first;
          advance(__mid, __elems_after);
# else
          __const_pointer__ __mid = __first + __elems_after;
# endif
          uninitialized_copy(__mid, __last, _M_finish);
          _M_finish += __n - __elems_after;
          uninitialized_copy(__position, __old_finish, _M_finish);
          _M_finish += __elems_after;
          copy(__first, __mid, __position);
      }
    }
    else {
      const size_type __old_size = size();
      const size_type __len = __old_size + max(__old_size, __n);
      pointer __new_start = _M_end_of_storage.allocate(__len);
      pointer __new_finish = __new_start;
      __STL_TRY {
	__new_finish = uninitialized_copy(_M_start, __position, __new_start);
	__new_finish = uninitialized_copy(__first, __last, __new_finish);
	__new_finish
	  = uninitialized_copy(__position, _M_finish, __new_finish);
      }
      __STL_UNWIND((_Destroy(__new_start,__new_finish), 
		    _M_end_of_storage.deallocate(__new_start,__len)));
      _Destroy(_M_start, _M_finish);
      _M_end_of_storage.deallocate(_M_start, _M_end_of_storage._M_data - _M_start);
      _M_start = __new_start;
      _M_finish = __new_finish;
      _M_end_of_storage._M_data = __new_start + __len;
    }
  }
Ejemplo n.º 4
0
void BinaryTree<T>::_Destroy(Node *root){
	if(root==NULL){
		return ;
	}
	_Destroy(root->_left);
	_Destroy(root->_right);
#ifdef __DEBUG__
	std::cout<<root->_value<<" ";
#endif
	delete root;
}
/**
 * @brief 지형객체를 초기화한다.
 * @param pDev : 출력용 D3D디바이스 
 * @param pvfScale : 높이맵의 x,y,z값에 곱할 척도값(scale vector)
 * @param lpBMPFilename : 높이맵용 BMP파일명
 * @param lpTexFilename : 출력용 D3D디바이스 
 */
HRESULT	ZTerrain::Create( LPDIRECT3DDEVICE9 pDev, D3DXVECTOR3* pvfScale, LPSTR lpBMPFilename, LPSTR lpTEXFilename[4] )
{
	m_pd3dDevice = pDev;
	m_vfScale = *pvfScale;
	if( FAILED( _BuildHeightMap( lpBMPFilename ) ) ) { _Destroy(); return E_FAIL; }
	if( FAILED( _LoadTextures( lpTEXFilename ) ) ) { _Destroy(); return E_FAIL; }
	if( FAILED( _CreateVIB() ) ) { _Destroy(); return E_FAIL; }
	m_pQuadTree = new ZQuadTree( m_cxDIB, m_czDIB );
	if( FAILED( _BuildQuadTree() ) ) { _Destroy(); return E_FAIL; }

	return S_OK;
}
Ejemplo n.º 6
0
	void _Destroy(Node* root)
	{
		if (root->_left == NULL && root->_right == NULL)
		{
			delete root;
			root = NULL;
		}
		else
		{
			_Destroy(root->_left);
			_Destroy(root->_right);
		}
	}
Ejemplo n.º 7
0
/**
 * @brief 지형객체를 초기화한다.
 * @param pDev : 출력용 D3D디바이스 
 * @param pvfScale : 높이맵의 x,y,z값에 곱할 척도값(scale vector)
 * @param lpBMPFilename : 높이맵용 BMP파일명
 * @param lpTexFilename : 출력용 D3D디바이스 
 */
HRESULT	ZTerrain::Create( D3DXVECTOR3* pvfScale, const char* lpBMPFilename, const char* lpTEXFilename )
{	
	if (pvfScale!=NULL)
	{
		m_vfScale = *pvfScale;
	}	
	
	try
	{
		if( FAILED( _BuildHeightMap( lpBMPFilename ) ) ) throw ("지형 높이맵 BMP파일없음\n");
		if( FAILED( _LoadTextures( lpTEXFilename ) ) ) throw ("지형 텍스쳐 파일없음\n");
		if( FAILED( _CreateVIB() ) ) throw ("버텍스 인덱스 버퍼 생성에러\n");
	}
	catch (const char* msg)
	{
		OutputDebugString(msg);
		_Destroy(); 
		return E_FAIL;
	}
	m_pQuadTree = new ZQuadTree( this,0,m_cxDIB - 1,m_cxDIB * ( m_czDIB - 1 ), m_cxDIB * m_czDIB - 1 );
	AttachChildNode(m_pQuadTree);

	m_BoundingSphere = m_pQuadTree->GetBoundingSphere();
	QueueRenderer(this,true);
	return S_OK;
}
Ejemplo n.º 8
0
	~HuffmanTree()
	{
		if (_root)
		{
			_Destroy(_root);
		}
	}
	void reserve(size_type _Count)
		{	// determine new minimum length of allocated storage
		if (max_size() < _Count)
			_Xlen();	// result too long
		else if (capacity() < _Count)
			{	// not enough room, reallocate
			pointer _Ptr = this->_Alval.allocate(_Count);

			_TRY_BEGIN
			_Umove(this->_Myfirst, this->_Mylast, _Ptr);
			_CATCH_ALL
			this->_Alval.deallocate(_Ptr, _Count);
			_RERAISE;
			_CATCH_END

			size_type _Size = size();
			if (this->_Myfirst != 0)
				{	// destroy and deallocate old array
				_Destroy(this->_Myfirst, this->_Mylast);
				this->_Alval.deallocate(this->_Myfirst,
					this->_Myend - this->_Myfirst);
				}

			this->_Orphan_all();
			this->_Myend = _Ptr + _Count;
			this->_Mylast = _Ptr + _Size;
			this->_Myfirst = _Ptr;
			}
		}
Ejemplo n.º 10
0
void CEditorRenderDevice::Reset(IReader* F, BOOL bKeepTextures)
{
	CTimer tm;
    tm.Start();
	_Destroy		(bKeepTextures);
	_Create			(F);
	Msg				("*** RESET [%d ms]",tm.GetElapsed_ms());
}
Ejemplo n.º 11
0
BinaryTree<T>::~BinaryTree(){
#ifdef __DEBUG__
	std::cout<<"DEBUG:检查析构:";
#endif
	_Destroy(_root);
#ifdef __DEBUG__
	std::cout<<std::endl;
#endif
}
Ejemplo n.º 12
0
void FvAura::End()
{
	if(HasState(FvAuraState::END))
	{
		return;
	}
	_AddState(FvAuraState::END);
	_OnEnd();
	_Destroy();
}
Ejemplo n.º 13
0
void CL_HeapBTreeNodeSpace::_DestroySubtree (CL_BTreeNodeHandle h)
{
    // Do a post-order walk, destroying nodes as we go along
    if (!h)
        return;
    CL_GenericBTreeNode* node = (CL_GenericBTreeNode*) h;
    register short n = node->Size();
    for (register short i = 0; i <= n; i++)
        _DestroySubtree (node->Subtree(i));
    _Destroy (node);
}
Ejemplo n.º 14
0
// Change the string's capacity so that it is large enough to hold
//  at least __res_arg elements, plus the terminating _CharT().  Note that,
//  if __res_arg < capacity(), this member function may actually decrease
//  the string's capacity.
template <class _CharT, class _Traits, class _Alloc> void basic_string<_CharT,_Traits,_Alloc>::reserve(size_type __res_arg) {
  if (__res_arg > max_size())
    this->_M_throw_length_error();

  size_type __n = (max)(__res_arg, size()) + 1;
  pointer __new_start = this->_M_end_of_storage.allocate(__n);
  pointer __new_finish = __new_start;

  _STLP_TRY {
    __new_finish = uninitialized_copy(this->_M_start, this->_M_finish, __new_start);
    _M_construct_null(__new_finish);
  }
  _STLP_UNWIND((_Destroy(__new_start, __new_finish), 
                this->_M_end_of_storage.deallocate(__new_start, __n)));

  _Destroy(this->_M_start, this->_M_finish + 1);
  this->_M_deallocate_block();
  this->_M_start = __new_start;
  this->_M_finish = __new_finish;
  this->_M_end_of_storage._M_data = __new_start + __n;
}
Ejemplo n.º 15
0
void 
_List_base<_Tp,_Alloc>::clear() 
{
  _List_node<_Tp>* __cur = (_List_node<_Tp>*) this->_M_node._M_data->_M_next;
  while (__cur != this->_M_node._M_data) {
    _List_node<_Tp>* __tmp = __cur;
    __cur = (_List_node<_Tp>*) __cur->_M_next;
    _Destroy(&__tmp->_M_data);
    this->_M_node.deallocate(__tmp, 1);
  }
  this->_M_node._M_data->_M_next = this->_M_node._M_data;
  this->_M_node._M_data->_M_prev = this->_M_node._M_data;
}
/// 정점, 인덱스 버퍼를 생성한다.
HRESULT	ZTerrain::_CreateVIB()
{
	// VB생성
	if( FAILED( m_pd3dDevice->CreateVertexBuffer( m_cxDIB*m_czDIB*sizeof(TERRAINVERTEX),
												  0, TERRAINVERTEX::FVF, D3DPOOL_DEFAULT, &m_pVB, NULL ) ) )
    {
        _Destroy();
		return E_FAIL;
    }
    VOID* pVertices;
    if( FAILED( m_pVB->Lock( 0, m_cxDIB*m_czDIB*sizeof(TERRAINVERTEX), (void**)&pVertices, 0 ) ) )
	{
        _Destroy();
        return E_FAIL;
	}
	memcpy( pVertices, m_pvHeightMap, m_cxDIB*m_czDIB*sizeof(TERRAINVERTEX) );
	m_pVB->Unlock();

#ifdef _USE_INDEX16
	// IB생성
    if( FAILED( m_pd3dDevice->CreateIndexBuffer( (m_cxDIB-1)*(m_czDIB-1)*2 * sizeof(TRIINDEX), 0, D3DFMT_INDEX16, D3DPOOL_DEFAULT, &m_pIB, NULL ) ) )
    {
        _Destroy();
        return E_FAIL;
    }
	g_pLog->Log( "Using 16bit index buffer..." );
#else
	// IB생성
    if( FAILED( m_pd3dDevice->CreateIndexBuffer( (m_cxDIB-1)*(m_czDIB-1)*2 * sizeof(TRIINDEX), 0, D3DFMT_INDEX32, D3DPOOL_DEFAULT, &m_pIB, NULL ) ) )
    {
        _Destroy();
        return E_FAIL;
    }
	g_pLog->Log( "Using 32bit index buffer..." );
#endif

    return S_OK;
}
Ejemplo n.º 17
0
template <class _CharT, class _Traits, class _Alloc> basic_string<_CharT,_Traits,_Alloc>& basic_string<_CharT,_Traits,_Alloc>::append(size_type __n, _CharT __c) {
  if (__n > max_size() || size() > max_size() - __n)
    this->_M_throw_length_error();
  if (size() + __n > capacity())
    reserve(size() + (max)(size(), __n));
  if (__n > 0) {
    uninitialized_fill_n(this->_M_finish + 1, __n - 1, __c);
    _STLP_TRY {
      _M_construct_null(this->_M_finish + __n);
    }
    _STLP_UNWIND(_Destroy(this->_M_finish + 1, this->_M_finish + __n));
    _Traits::assign(*end(), __c);
    this->_M_finish += __n;
  }
	_Myt& operator=(const _Myt& _Right)
		{	// assign _Right
		if (this != &_Right)
			{	// worth doing
			this->_Orphan_all();

			if (_Right.size() == 0)
				clear();	// new sequence empty, erase existing sequence
			else if (_Right.size() <= size())
				{	// enough elements, copy new and destroy old
				pointer _Ptr = _STD _Copy_impl(_Right._Myfirst, _Right._Mylast,
					this->_Myfirst);	// copy new
				_Destroy(_Ptr, this->_Mylast);	// destroy old
				this->_Mylast = this->_Myfirst + _Right.size();
				}
			else if (_Right.size() <= capacity())
				{	// enough room, copy and construct new
				pointer _Ptr = _Right._Myfirst + size();
				_STD _Copy_impl(_Right._Myfirst, _Ptr, this->_Myfirst);
				this->_Mylast = _Ucopy(_Ptr, _Right._Mylast, this->_Mylast);
				}
			else
				{	// not enough room, allocate new array and construct new
				if (this->_Myfirst != 0)
					{	// discard old array
					_Destroy(this->_Myfirst, this->_Mylast);
					this->_Alval.deallocate(this->_Myfirst,
						this->_Myend - this->_Myfirst);
					}
				if (_Buy(_Right.size()))
					this->_Mylast = _Ucopy(_Right._Myfirst, _Right._Mylast,
						this->_Myfirst);
				}
			}
		return (*this);
		}
Ejemplo n.º 19
0
void 
_List_base<_Tp,_Alloc>::clear() 
{
 //选取_M_node->_M_next作为当前节点
 _List_node<_Tp>* __cur = (_List_node<_Tp>*) _M_node->_M_next;
  while (__cur != _M_node) {//遍历每一个节点
    _List_node<_Tp>* __tmp = __cur;//设置一个节点临时别名
    __cur = (_List_node<_Tp>*) __cur->_M_next;//指向下一个节点
    _Destroy(&__tmp->_M_data);//析构数据对象
    _M_put_node(__tmp);//回收节点tmp指向的内存空间
  }
  //空链表,即前驱和后继指针都指向自己
  _M_node->_M_next = _M_node;
  _M_node->_M_prev = _M_node;
}
Ejemplo n.º 20
0
	void _Destroy(GeneralListNode* head)
	{
		GeneralListNode* begin = head;
		while (begin)
		{
			GeneralListNode* del = begin;
			begin = begin->_next;

			if(del->_type == SUB_TYPE)
			{
				_Destroy(del->_subLink);
			}

			delete del;
		}
	}
Ejemplo n.º 21
0
void 
__vector__<_Tp, _Alloc>::reserve(__size_type__ __n) {
  if (capacity() < __n) {
    const size_type __old_size = size();
    pointer __tmp;
    if (_M_start) {
      __tmp = _M_allocate_and_copy(__n, _M_start, _M_finish);
      _Destroy(_M_start, _M_finish);
      _M_end_of_storage.deallocate(_M_start, _M_end_of_storage._M_data - _M_start);
     } else {
      __tmp = _M_end_of_storage.allocate(__n);
    }
    _M_start = __tmp;
    _M_finish = __tmp + __old_size;
    _M_end_of_storage._M_data = _M_start + __n;
  }
}
Ejemplo n.º 22
0
//---------------------------------------------------------------------------
void CEditorRenderDevice::Destroy(){
	if (!b_is_Ready) return;

	ELog.Msg( mtInformation, "Destroying Direct3D...");

	HW.Validate			();

	// before destroy
	_Destroy			(FALSE);
	xr_delete			(Resources);

	// real destroy
	HW.DestroyDevice	();

	ELog.Msg( mtInformation, "D3D: device cleared" );
    xr_delete			(Statistic);
}
Ejemplo n.º 23
0
__vector__<_Tp,_Alloc>& 
__vector__<_Tp,_Alloc>::operator=(const __vector__<_Tp, _Alloc>& __x)
{
  if (&__x != this) {
    const size_type __xlen = __x.size();
    if (__xlen > capacity()) {
      pointer __tmp = _M_allocate_and_copy(__xlen, (const_pointer)__x._M_start+0, (const_pointer)__x._M_finish+0);
      _M_clear();
      this->_M_start = __tmp;
      this->_M_end_of_storage._M_data = this->_M_start + __xlen;
    }
    else if (size() >= __xlen) {
      pointer __i = __copy_ptrs((const_pointer)__x._M_start+0, (const_pointer)__x._M_finish+0, (pointer)this->_M_start, _TrivialAss());
      _Destroy(__i, this->_M_finish);
    }
    else {
      __copy_ptrs((const_pointer)__x._M_start, (const_pointer)__x._M_start + size(), (pointer)this->_M_start, _TrivialAss());
      __uninitialized_copy((const_pointer)__x._M_start + size(), (const_pointer)__x._M_finish+0, this->_M_finish, _IsPODType());
    }
    this->_M_finish = this->_M_start + __xlen;
  }
  return *this;
}
Ejemplo n.º 24
0
STDAPI CInputModeWindow::OnLayoutChange(ITfContext *pContext, TfLayoutCode lcode, ITfContextView *pContextView)
{
	HRESULT hr;

	if(pContext != _pContext)
	{
		return S_OK;
	}

	switch(lcode)
	{
	case TF_LC_CREATE:
		break;

	case TF_LC_CHANGE:
		try
		{
			CInputModeWindowGetTextExtEditSession *pEditSession =
				new CInputModeWindowGetTextExtEditSession(_pTextService, pContext, pContextView, this);
			pContext->RequestEditSession(_pTextService->_GetClientId(), pEditSession, TF_ES_SYNC | TF_ES_READ, &hr);
			SafeRelease(&pEditSession);
		}
		catch(...)
		{
		}
		break;

	case TF_LC_DESTROY:
		_Destroy();
		break;

	default:
		break;
	}

	return S_OK;
}
Ejemplo n.º 25
0
CInputModeWindow::~CInputModeWindow()
{
	_Destroy();

	DllRelease();
}
Ejemplo n.º 26
0
CL_DiskBTreeNodeSpace::~CL_DiskBTreeNodeSpace ()
{
    if (_tmp)
        _Destroy (_tmp);
}
Ejemplo n.º 27
0
void CL_DiskBTreeNodeSpace::ReturnNode (CL_GenericBTreeNode* n) const
{
    if (_tmp)
        _Destroy (_tmp);
    ((CL_DiskBTreeNodeSpace*) this)->_tmp = n; // cast away const
}
/// 소멸자
ZTerrain::~ZTerrain()
{
	_Destroy();
}
// 소멸자
ZQuadTree::~ZQuadTree()
{
	_Destroy();
}
Ejemplo n.º 30
0
	void Destory()
	{
		_Destroy(_head);
		_head = NULL;
	}