Exemplo n.º 1
0
Model* FBXFactory::LoadModel(const char* aFilePath, Effect* aEffect)
{
	FBXData* found = 0;
	for (FBXData* data : myFBXData)
	{ 
		if (data->myPath.compare(aFilePath) == 0)
		{
			found = data;
			break;
		}
	}

	FbxModelData* modelData = nullptr;
	if (found)
	{
		modelData = found->myData;
	}
	else
	{
		FBXData* data = new FBXData();
		FbxModelData* fbxModelData = myLoader->loadModel(aFilePath);
		data->myData = fbxModelData;
		data->myPath = aFilePath;
		myFBXData.push_back(data);
		modelData = data->myData;
	}


	Model* returnModel = CreateModel(modelData, aEffect);
	return returnModel;
}
Exemplo n.º 2
0
bool Transport::Create(ObjectGuid::LowType guidlow, uint32 entry, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress)
{
    Relocate(x, y, z, ang);

    if (!IsPositionValid())
    {
        TC_LOG_ERROR("entities.transport", "Transport (GUID: " UI64FMTD ") not created. Suggested coordinates isn't valid (X: %f Y: %f)",
            guidlow, x, y);
        return false;
    }

    Object::_Create(ObjectGuid::Create<HighGuid::Transport>(guidlow));

    GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry);
    if (!goinfo)
    {
        TC_LOG_ERROR("sql.sql", "Transport not created: entry in `gameobject_template` not found, guidlow: " UI64FMTD " map: %u  (X: %f Y: %f Z: %f) ang: %f", guidlow, mapid, x, y, z, ang);
        return false;
    }

    m_goInfo = goinfo;
    m_goTemplateAddon = sObjectMgr->GetGameObjectTemplateAddon(entry);

    TransportTemplate const* tInfo = sTransportMgr->GetTransportTemplate(entry);
    if (!tInfo)
    {
        TC_LOG_ERROR("sql.sql", "Transport %u (name: %s) will not be created, missing `transport_template` entry.", entry, goinfo->name.c_str());
        return false;
    }

    _transportInfo = tInfo;

    // initialize waypoints
    _nextFrame = tInfo->keyFrames.begin();
    _currentFrame = _nextFrame++;
    _triggeredArrivalEvent = false;
    _triggeredDepartureEvent = false;

    if (m_goTemplateAddon)
    {
        SetFaction(m_goTemplateAddon->faction);
        SetUInt32Value(GAMEOBJECT_FLAGS, m_goTemplateAddon->flags);
    }

    m_goValue.Transport.PathProgress = 0;
    SetObjectScale(goinfo->size);
    SetPeriod(tInfo->pathTime);
    SetEntry(goinfo->entry);
    SetDisplayId(goinfo->displayId);
    SetGoState(!goinfo->moTransport.allowstopping ? GO_STATE_READY : GO_STATE_ACTIVE);
    SetGoType(GAMEOBJECT_TYPE_MAP_OBJ_TRANSPORT);
    SetGoAnimProgress(animprogress);
    SetName(goinfo->name);
    SetWorldRotation(0.0f, 0.0f, 0.0f, 1.0f);
    SetParentRotation(QuaternionData());

    m_model = CreateModel();
    return true;
}
Exemplo n.º 3
0
void FbExportDlg::OnCheckAuthor( wxCommandEvent& event )
{
	if (!m_struct) return;
	int author = 0;
	if ( m_checkAuthor && m_checkAuthor->GetValue() ) author = m_author;
	wxString structure = m_struct->GetValue();
	m_books->AssignModel(CreateModel(author, structure));
}
Exemplo n.º 4
0
bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress)
{
    Relocate(x, y, z, ang);

    if (!IsPositionValid())
    {
        SF_LOG_ERROR("entities.transport", "Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
            guidlow, x, y);
        return false;
    }

    Object::_Create(guidlow, 0, HIGHGUID_MO_TRANSPORT);

    GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry);

    if (!goinfo)
    {
        SF_LOG_ERROR("sql.sql", "Transport not created: entry in `gameobject_template` not found, guidlow: %u map: %u  (X: %f Y: %f Z: %f) ang: %f", guidlow, mapid, x, y, z, ang);
        return false;
    }

    m_goInfo = goinfo;

    TransportTemplate const* tInfo = sTransportMgr->GetTransportTemplate(entry);
    if (!tInfo)
    {
        SF_LOG_ERROR("sql.sql", "Transport %u (name: %s) will not be created, missing `transport_template` entry.", entry, goinfo->name.c_str());
        return false;
    }

    _transportInfo = tInfo;

    // initialize waypoints
    _nextFrame = tInfo->keyFrames.begin();
    _currentFrame = _nextFrame++;
    _triggeredArrivalEvent = false;
    _triggeredDepartureEvent = false;

    m_goValue.Transport.PathProgress = 0;
    SetFloatValue(OBJECT_FIELD_SCALE, goinfo->size);
    SetUInt32Value(GAMEOBJECT_FIELD_FACTION_TEMPLATE, goinfo->faction);
    SetUInt32Value(GAMEOBJECT_FIELD_FLAGS, goinfo->flags);
    SetPeriod(tInfo->pathTime);
    SetEntry(goinfo->entry);
    SetDisplayId(goinfo->displayId);
    SetGoState(GO_STATE_READY);
    _pendingStop = goinfo->moTransport.canBeStopped != 0;
    SetGoType(GAMEOBJECT_TYPE_MO_TRANSPORT);
    SetGoAnimProgress(animprogress);
    SetName(goinfo->name);
    UpdateRotationFields(0.0f, 1.0f);
    m_model = CreateModel();
    return true;
}
Exemplo n.º 5
0
long GenModelCplex::CreateModel(string filename, int type, string dn)
{
#ifdef OSI_MODULE
    ReadFromFile(static_cast<GenModel*>(this), filename, type);
    SetNumbers();
    CreateModel();
#else
    return ThrowError("Cannot use CreateModel(filenamem, type, dn) : Osi Module not present");
#endif
    return 0;
}
Exemplo n.º 6
0
Bullet::Bullet(GameObject* shooter, glm::vec3 dir, float maxDistance)
{
	m_name = "Bullet";
	CreateModel(m_name);
	m_model->GenCube(0.03f);
	EnableCollision();
	
	m_shooter = shooter;
	m_dir = dir;
	m_maxDistance = maxDistance;
}
Exemplo n.º 7
0
		GLModel *GLModelManager::RegisterModel(const char *name){
			SPADES_MARK_FUNCTION();
			
			std::map<std::string, GLModel *>::iterator it;
			it = models.find(std::string(name));
			if(it == models.end()){
				GLModel *m = CreateModel(name);
				models[name] = m;
				return m;
			}
			return it->second;
		}
Exemplo n.º 8
0
void PluginWebView::LoadURL(const String& url)
{
	if(url=="") return;

	IWnd_webview* wv=GetActiveWebView();
	if(wv)
	{
		wv->LoadURL(url);
	}
	else
	{
		DataPtrT<MvcModel> pModel=CreateModel(url);
		if(!pModel) return;
		this->OpenModel(m_pSampleModel.get());
	}
}
Exemplo n.º 9
0
Model* FBXFactory::CreateModel(FbxModelData* someModelData, Effect* aEffect)
{
	Model* tempModel = new Model();
	tempModel->myEffect = aEffect;
		
	if (someModelData->myData)
	{
		FillData(someModelData->myData, tempModel, aEffect);
		tempModel->myOrientation = someModelData->myOrientation;

	}
	for (int i = 0; i < someModelData->myChilds.Size(); ++i)
	{
		auto currentChild = someModelData->myChilds[i];
		tempModel->AddChild(CreateModel(currentChild, aEffect));
	}
	return tempModel;
}
Exemplo n.º 10
0
PxSolidObject * PxObjectFactory::GetObject(const PxRuntimeObject & ro)
{
    switch(ro.Type)
    {
    case rtoCube:
        return CreateCube(ro);
    case rtoFlag:
        return CreateFlag(ro);
    case rtoFountain:
        return CreateFountain(ro);
    case rtoSteps:
        return CreateSteps(ro);
    case rtoHoarding:
        return CreateHoarding(ro);
    case rtoModel:
        return CreateModel(ro);
    }
    return nullptr;
}
Exemplo n.º 11
0
const char* PezInitialize(int width, int height)
{
    TessLevel = 10.0;
    TessLevelOuter = 7;



    //    CreateIcosahedron();
    // CreateCube();
    //CreateObject();
        CreateModel();


    LoadEffect();

    Uniforms.Projection = glGetUniformLocation(ProgramHandle, "Projection");
    Uniforms.Modelview = glGetUniformLocation(ProgramHandle, "Modelview");
    Uniforms.NormalMatrix = glGetUniformLocation(ProgramHandle, "NormalMatrix");
    Uniforms.LightPosition = glGetUniformLocation(ProgramHandle, "LightPosition");
    Uniforms.AmbientMaterial = glGetUniformLocation(ProgramHandle, "AmbientMaterial");
    Uniforms.DiffuseMaterial = glGetUniformLocation(ProgramHandle, "DiffuseMaterial");
    Uniforms.TessLevel = glGetUniformLocation(ProgramHandle, "TessLevel");
    Uniforms.TessLevelOuter = glGetUniformLocation(ProgramHandle, "TessLevelOuter");
    Uniforms.NormalModel = glGetUniformLocation(ProgramHandle, "NormalModel");
    Uniforms.Tesselation = glGetUniformLocation(ProgramHandle, "Tesselation");
    Uniforms.Wireframe = glGetUniformLocation(ProgramHandle, "Wireframe");
    Uniforms.Tagg = glGetUniformLocation(ProgramHandle, "Tagg");
    Uniforms.ColNorm = glGetUniformLocation(ProgramHandle, "ColNorm");
    Uniforms.DCol = glGetUniformLocation(ProgramHandle, "DCol");

    // Set up the projection matrix:
    const float HalfWidth = 0.6f;
    const float HalfHeight = HalfWidth * PEZ_VIEWPORT_HEIGHT / PEZ_VIEWPORT_WIDTH;
    ProjectionMatrix = M4MakeFrustum(-HalfWidth, +HalfWidth, -HalfHeight, +HalfHeight, 5, 150);

    // Initialize various state:
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_CULL_FACE);
    glClearColor(0.7f, 0.6f, 0.5f, 1.0f);

    return "Tessellation Demo";
}
Exemplo n.º 12
0
GtkWidget * CreateView()
{
    GtkTreeViewColumn *col;
    GtkCellRenderer *renderer;
    GtkTreeModel *model;
    GtkWidget *view;

    view = gtk_tree_view_new ();

    col = gtk_tree_view_column_new();
    gtk_tree_view_column_set_title (col,"Detected Devices");
    gtk_tree_view_append_column (GTK_TREE_VIEW(view),col);

    renderer = gtk_cell_renderer_text_new ();
    gtk_tree_view_column_pack_start (col,renderer,TRUE);
    gtk_tree_view_column_add_attribute (col,renderer,"text",COLUMN);

    model = CreateModel();
    gtk_tree_view_set_model(GTK_TREE_VIEW(view),model);
    g_object_unref(model);

    return view;
}
void CreateVBO(void)
{
	CreateModel();
	AverageNormals();
    glGenVertexArrays(1, &VaoId);
	glBindVertexArray(VaoId);

	glGenBuffers(1, &VboId);
	glBindBuffer(GL_ARRAY_BUFFER, VboId);
	glBufferData(GL_ARRAY_BUFFER, sizeof(points) + sizeof(normals), NULL, GL_STATIC_DRAW);
	glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(points), points);
	glBufferSubData(GL_ARRAY_BUFFER, sizeof(points), sizeof(normals),normals);

	glEnableVertexAttribArray(0);
	glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0));

	//glGenBuffers(1, &NormalBufferId);
	//glBindBuffer(GL_ARRAY_BUFFER, NormalBufferId);
	//glBufferData(GL_ARRAY_BUFFER, sizeof(normals), normals, GL_STATIC_DRAW);

	glEnableVertexAttribArray(1);
	glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(sizeof(points)));
}
Exemplo n.º 14
0
VOID CGamePro_CharCreate::Init(VOID)
{
	//s_pGfxSystem->Scene_Load( -1, "yangliucun.scene" );
	s_pGfxSystem->Camera_SetEyePos   (fVector3(1000, 325, 1000));
	s_pGfxSystem->Camera_SetLookAtPos(fVector3(1000, 320, 0));
	
	if(0 == m_iIsLoadFace)
	{
		int res = m_FaceMng.GetCharacterFaceIfo();
		if(0 == res)
		{
			m_iIsLoadFace = 1;
		}
	}

	if(0 == m_iIsLoadFaceModel)
	{
		int res = m_FaceModelmng.GetCharacterModel();
		if(0 == res)
		{
			m_iIsLoadFaceModel = 1;
		}
	}

	if(0 == m_iIsLoadHairModel)
	{
		int res = m_HairModelMng.GetCharacterModel();
		if(0 == res)
		{
			m_iIsLoadHairModel = 1;
		}
	}

	// 创建模型信息.
	CreateModel();
}
Exemplo n.º 15
0
void Solver::SetSystem(System* s){
  system = s;
  CreateModel();
}
Exemplo n.º 16
0
Model::Model(string filename)
{
    CreateModel(filename);
}
void CGameFactory::CreateNewGame( const GDModel::CGameInitialisationData& data, CMapView *mapView, const CTerrainType * defaultTerrainType )
{
	CreateModel( data );
	CreateMap( data, mapView, defaultTerrainType );
}
Exemplo n.º 18
0
FbExportDlg::FbExportDlg( wxWindow* parent, const wxString & selections, int author) :
	FbDialog( parent, wxID_ANY, _("Export to external storage"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
	m_selections(selections),
	m_author(author),
	m_struct(NULL),
	m_checkAuthor(NULL)
{
	SetSizeHints( wxDefaultSize, wxDefaultSize );

	wxBoxSizer * bSizerMain = new wxBoxSizer( wxVERTICAL );

	wxFlexGridSizer * fgSizerTop = new wxFlexGridSizer( 2, 2, 0, 0 );
	fgSizerTop->AddGrowableCol( 1 );
	fgSizerTop->SetFlexibleDirection( wxBOTH );
	fgSizerTop->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );

	wxStaticText * folder_info = new wxStaticText( this, wxID_ANY, _("Destination folder:"));
	folder_info->Wrap( -1 );
	fgSizerTop->Add( folder_info, 0, wxTOP|wxLEFT|wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5 );

	m_folder = new FbCustomCombo(this, ID_DIR_TXT);
	m_folder->SetMinSize( wxSize( 300,-1 ) );
	fgSizerTop->Add( m_folder, 0, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );

	wxStaticText * format_info = new wxStaticText( this, wxID_ANY, _("Exported structure:"));
	format_info->Wrap( -1 );
	fgSizerTop->Add( format_info, 0, wxTOP|wxLEFT|wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5 );

	wxString structure = FbParams(FB_FOLDER_FORMAT).Str();

	m_struct = new wxComboBox( this, ID_STRUCT, structure, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
	m_folder->SetMinSize( wxSize( 300,-1 ) );
	m_struct->Append( wxT("%a/%f/%s/%n %t") );
	m_struct->Append( wxT("%a/%f/%t") );
	m_struct->Append( wxT("%f/%s/%n %t") );
	m_struct->Append( wxT("%f/%s/%t") );
	m_struct->Append( wxT("%f/%m") );
	fgSizerTop->Add( m_struct, 0, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );

	bSizerMain->Add( fgSizerTop, 0, wxEXPAND, 5 );

	wxBoxSizer * bSizerTrans = new wxBoxSizer( wxHORIZONTAL );

	m_transDir = new wxCheckBox( this, ID_DIR, _("Transliterate folder name"));
	bSizerTrans->Add( m_transDir, 1, wxALL|wxEXPAND, 5 );

	m_transFile = new wxCheckBox( this, ID_FILE, _("Transliterate filename"));
	bSizerTrans->Add( m_transFile, 1, wxALL|wxEXPAND, 5 );

	bSizerMain->Add( bSizerTrans, 0, wxEXPAND, 5 );

	if (author) {
		m_checkAuthor = new wxCheckBox( this, ID_AUTHOR, _("Use Author (without co-Authors)"));
		bSizerMain->Add( m_checkAuthor, 0, wxALL, 5 );
		m_checkAuthor->SetValue(1);
	}

	m_books = new FbTreeViewCtrl( this, ID_BOOKS, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN | fbTR_VRULES);
	m_books->SetMinSize( wxSize( -1,250 ) );
	m_books->AddColumn (0, _("File name"), -10, wxALIGN_LEFT);
	m_books->AddColumn (1, _("Size, Kb"), 6, wxALIGN_RIGHT);

	bSizerMain->Add( m_books, 1, wxALL|wxEXPAND, 5 );

	wxBoxSizer* bSizerFormat;
	bSizerFormat = new wxBoxSizer( wxHORIZONTAL );

	wxStaticText * m_staticTextFormat = new wxStaticText( this, wxID_ANY, _("Export As..."));
	m_staticTextFormat->Wrap( -1 );
	bSizerFormat->Add( m_staticTextFormat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	m_format = new FbChoiceInt( this, ID_FORMAT, wxDefaultPosition, wxDefaultSize);
	bSizerFormat->Add( m_format, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	bSizerMain->Add( bSizerFormat, 0, wxEXPAND, 5 );

	m_folder->SetValue( FbParamItem::GetPath(FB_EXTERNAL_DIR) );
	m_transDir->SetValue( FbParams(FB_TRANSLIT_FOLDER) );
	m_transFile->SetValue( FbParams(FB_TRANSLIT_FILE) );

	wxStdDialogButtonSizer * sdbSizerBtn = CreateStdDialogButtonSizer( wxOK | wxCANCEL );
	bSizerMain->Add( sdbSizerBtn, 0, wxEXPAND|wxBOTTOM|wxLEFT|wxRIGHT, 5 );

	this->SetSizer( bSizerMain );
	this->Layout();
	bSizerMain->Fit( this );

	SetAffirmativeId(wxID_OK);
	SetEscapeId(wxID_CANCEL);

	LoadFormats();

	m_books->AssignModel(CreateModel(author, structure));
}