Ejemplo n.º 1
0
void CCmdBornObject::_Execute()
{
	string modelname("");
	size_t size = m_diff.vecEditModelFileNames.size();
	if( size == 1 )
	{
		modelname = m_diff.vecEditModelFileNames[0];
		m_diff.pParentModel = m_pEditContext->CreateEditModel(NULL);
		m_diff.pParentModel->AddPieceGroup(modelname.c_str());
	}
	else
	{
		for ( size_t i = 0; i < size; ++i )
		{
			modelname = m_diff.vecEditModelFileNames[i];
			if( modelname.empty() )
				continue;

			CEditModel* pChildModel = m_pEditContext->CreateEditModel(NULL);
			pChildModel->AddPieceGroup(modelname.c_str());

			m_diff.pParentModel->AddChild(pChildModel, LT_CENTER, "");
		}

	}

	m_diff.pParentModel->SetScale(m_diff.fScale);
	m_diff.pParentModel->RotateX(m_diff.vRotate.x);
	m_diff.pParentModel->RotateY(m_diff.vRotate.y);
	m_diff.pParentModel->RotateZ(m_diff.vRotate.z);
	m_diff.pParentModel->SetIsVisibleByConfigure(m_diff.bVisibleByConfigure);

	if( !m_diff.strAgpFileName.empty() )
		m_diff.pParentModel->AddAnimationGroup(m_diff.strAgpFileName.c_str());

	if( !m_diff.strEffectFileName.empty() && !m_diff.strEffectName.empty() )
		m_diff.pParentModel->AddEffect(m_diff.strEffectFileName.c_str(), m_diff.strEffectName.c_str(), CEffectPlayer::PLAY_LOOP, NULL);

	m_pEditContext->AddToRenderScene(m_diff.pParentModel);
	m_pModelBrush->SetActiveModelState(EES_MOVING);
	m_pModelBrush->SetActiveModel(m_diff.pParentModel);
}
Ejemplo n.º 2
0
void FNeuralNetLMBase::WriteLM(const string &outbase) {
  string modelname(outbase);
  modelname += ".model";
  cout << "writing " << modelname << endl;
  ofstream ofs;
  ofs.open(modelname, ios::binary | ios::out);
  if (ofs.fail()) {
    cout << "unable to open " << modelname << endl;
    exit(EXIT_FAILURE);
  }

  // TODO: write other parameters?

  neuralnet::write_single(ofs, l2_regularization_param_);
  neuralnet::write_single(ofs, adagrad_);

  neuralnet::write_single(ofs, nce_);
  neuralnet::write_single(ofs, num_negative_samples_);

  neuralnet::write_single(ofs, independent_);
  neuralnet::write_single(ofs, globalbias_);
  neuralnet::write_single(ofs, bias_);
  neuralnet::write_single(ofs, errorinput_cutoff_);

  neuralnet::write_single(ofs, use_factor_input_);
  neuralnet::write_single(ofs, use_factor_hidden_);
  neuralnet::write_single(ofs, weight_factor_output_);

  word_vocab_.WriteVocab(ofs);
  factor_vocab_.WriteVocab(ofs);
  neuralnet::write_2d_vector(ofs, factors_for_word_);

  WriteLMImpl(ofs);

  ofs.close();
}