コード例 #1
0
ファイル: Game.cpp プロジェクト: rmaloney77/destroy-the-core
void CreateCamera(int width, int height, vector3df position, vector3df target)
{
  //Build camera
  ISceneManager* sm = g_GameGraph->GetSceneManager();
  WorldState* worldState =
      static_cast<WorldState*> (g_GameGraph->GetWorldState());
  HexMap* hm = worldState->GetCurrentMap();

  if (NULL != sm)
  {
    if (NULL != hm)
    {
      ICameraSceneNode* orthoCam = sm->addCameraSceneNode(
          sm->getRootSceneNode(), position, target);

      matrix4 projMat;
      projMat.buildProjectionMatrixOrthoLH(width, height, -5, 5);
      orthoCam->setProjectionMatrix(projMat, true);
      orthoCam->bindTargetAndRotation(true);
      if (orthoCam->isOrthogonal())
      {
        CameraAnimator* cameraAnim = new CameraAnimator(position, width,
            height, hm->GetMapDimensions().Height,
            hm->GetMapDimensions().Width, worldState->GetHero(),
            hm->GetCoordinateTranslator());
        orthoCam->addAnimator(cameraAnim);
        cameraAnim->drop();
        cameraAnim = NULL;

        if (width > height)
        {
          LOGI("Creating a landscape camera.");
          landscapeCamera = orthoCam;
        }
        else
        {
          LOGI("Creating a portrait camera");
          portraitCamera = orthoCam;
        }
      }
      else
      {
        LOGE("The created camera is not orthoganol, something is wrong with the perspective matrix.");
      }
    }
    else
    {
      LOGE("The hex map created in the WorldState is NULL.");
    }
  }
  else
  {
    LOGE("The scene manager cannot be loaded from the device.");
  }
}
コード例 #2
0
ファイル: TrieHash.cpp プロジェクト: AcriCAA/cpp-ethereum
h256 hash256(u256Map const& _s)
{
	// build patricia tree.
	if (_s.empty())
		return h256();
	HexMap hexMap;
	for (auto i = _s.rbegin(); i != _s.rend(); ++i)
		hexMap[asNibbles(toBigEndianString(i->first))] = asString(rlp(i->second));
	RLPStream s;
	hash256rlp(hexMap, hexMap.cbegin(), hexMap.cend(), 0, s);
	return sha3(s.out());
}
コード例 #3
0
ファイル: TrieHash.cpp プロジェクト: AcriCAA/cpp-ethereum
bytes rlp256(StringMap const& _s)
{
	// build patricia tree.
	if (_s.empty())
		return bytes();
	HexMap hexMap;
	for (auto i = _s.rbegin(); i != _s.rend(); ++i)
		hexMap[asNibbles(i->first)] = i->second;
	RLPStream s;
	hash256aux(hexMap, hexMap.cbegin(), hexMap.cend(), 0, s);
	return s.out();
}
コード例 #4
0
h256 hash256(StringMap const& _s)
{
	// build patricia tree.
	if (_s.empty())
		return h256();
	HexMap hexMap;
	for (auto i = _s.rbegin(); i != _s.rend(); ++i)
		hexMap[toHex(i->first)] = i->second;
	RLPStream s;
	hash256rlp(hexMap, hexMap.cbegin(), hexMap.cend(), 0, s);
	return sha3(s.out());
}