overloads, tutorial 04 init
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
TARGET := tutorial_04.elf
|
||||
ENGINEDIR := ../../engine
|
||||
|
||||
#The Directories, Source, Includes, Objects, Binary and Resources
|
||||
SRCDIR := src
|
||||
INCDIR := inc
|
||||
BUILDDIR := obj
|
||||
TARGETDIR := bin
|
||||
RESDIR := res
|
||||
SRCEXT := cpp
|
||||
VSMEXT := vsm
|
||||
VCLEXT := vcl
|
||||
VCLPPEXT := vclpp
|
||||
DEPEXT := d
|
||||
OBJEXT := o
|
||||
|
||||
#Flags, Libraries and Includes
|
||||
CFLAGS :=
|
||||
LIB :=
|
||||
LIBDIRS :=
|
||||
INC := -I$(INCDIR)
|
||||
INCDEP := -I$(INCDIR)
|
||||
|
||||
include ../Makefile.tutorials-base
|
||||
@@ -0,0 +1,4 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
# _____ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||
# Licensed under Apache License 2.0
|
||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tyra>
|
||||
#include <memory.h>
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class Tutorial04 : public Game {
|
||||
public:
|
||||
Tutorial04(Engine* engine);
|
||||
~Tutorial04();
|
||||
|
||||
void init();
|
||||
void loop();
|
||||
|
||||
private:
|
||||
void loadMesh();
|
||||
|
||||
Engine* engine;
|
||||
|
||||
std::unique_ptr<StaticMesh> mesh;
|
||||
StaPipOptions renderOptions;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
@@ -0,0 +1,4 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
||||
@@ -0,0 +1,4 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
||||
@@ -0,0 +1,4 @@
|
||||
$ConfigFile = Join-Path $PSScriptRoot '../../windows-pcsx2.ps1'
|
||||
. $ConfigFile
|
||||
|
||||
RunPCSX2
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
# _____ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||
# Licensed under Apache License 2.0
|
||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||
*/
|
||||
|
||||
#include "engine.hpp"
|
||||
#include "tutorial_04.hpp"
|
||||
|
||||
/**
|
||||
* In this tutorial we will learn:
|
||||
* - How to get pad input and move the camera
|
||||
* - What is static pipeline and how to use it
|
||||
* - What is mesh (StaticMesh) and how to load it from .obj file
|
||||
*/
|
||||
|
||||
int main() {
|
||||
Tyra::Engine engine;
|
||||
Tyra::Tutorial04 game(&engine);
|
||||
engine.run(&game);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
# _____ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||
# Licensed under Apache License 2.0
|
||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||
*/
|
||||
|
||||
#include <tyra>
|
||||
#include "tutorial_04.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
Tutorial04::Tutorial04(Engine* t_engine) : engine(t_engine) {}
|
||||
|
||||
Tutorial04::~Tutorial04() {
|
||||
engine->renderer.getTextureRepository().freeByMesh(mesh.get());
|
||||
}
|
||||
|
||||
void Tutorial04::init() { loadMesh(); }
|
||||
|
||||
void Tutorial04::loop() {}
|
||||
|
||||
void Tutorial04::loadMesh() {
|
||||
ObjLoader loader;
|
||||
ObjLoaderOptions options;
|
||||
options.flipUVs = true;
|
||||
options.scale = 200.0F;
|
||||
auto data = loader.load(FileUtils::fromCwd("de_dust2/de_dust2.obj"), options);
|
||||
|
||||
mesh = std::make_unique<StaticMesh>(data.get());
|
||||
|
||||
engine->renderer.getTextureRepository().addByMesh(
|
||||
mesh.get(), FileUtils::fromCwd("de_dust2/"), "png");
|
||||
}
|
||||
|
||||
} // namespace Tyra
|
||||
Reference in New Issue
Block a user