2015-05-24 07:55:12 +03:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-18 02:08:10 +03:00
|
|
|
// Licensed under GPLv2+
|
2013-04-18 06:09:55 +03:00
|
|
|
// Refer to the license.txt file included.
|
2008-12-08 06:46:09 +02:00
|
|
|
|
2014-02-10 20:54:46 +02:00
|
|
|
#pragma once
|
2008-12-08 06:46:09 +02:00
|
|
|
|
2009-02-15 15:45:03 +02:00
|
|
|
// Top vertex loaders
|
|
|
|
// Metroid Prime: P I16-flt N I16-s16 T0 I16-u16 T1 i16-flt
|
|
|
|
|
2010-03-05 14:04:09 +02:00
|
|
|
#include <algorithm>
|
2008-12-08 06:46:09 +02:00
|
|
|
#include <string>
|
|
|
|
|
2014-09-08 04:06:58 +03:00
|
|
|
#include "Common/CommonTypes.h"
|
2009-02-28 18:33:59 +02:00
|
|
|
|
2014-02-17 12:18:15 +02:00
|
|
|
#include "VideoCommon/CPMemory.h"
|
|
|
|
#include "VideoCommon/DataReader.h"
|
|
|
|
#include "VideoCommon/NativeVertexFormat.h"
|
2014-12-13 02:51:14 +02:00
|
|
|
#include "VideoCommon/VertexLoaderBase.h"
|
2014-11-29 04:39:24 +02:00
|
|
|
#include "VideoCommon/VertexLoaderUtils.h"
|
2008-12-08 06:46:09 +02:00
|
|
|
|
2014-12-13 02:51:14 +02:00
|
|
|
|
2014-12-13 11:57:46 +02:00
|
|
|
class VertexLoader;
|
2015-06-19 22:18:16 +03:00
|
|
|
typedef void (*TPipelineFunction)(VertexLoader* loader);
|
2014-07-08 16:58:25 +03:00
|
|
|
|
2014-12-13 02:51:14 +02:00
|
|
|
class VertexLoader : public VertexLoaderBase
|
2008-12-08 06:46:09 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
VertexLoader(const TVtxDesc &vtx_desc, const VAT &vtx_attr);
|
|
|
|
|
2015-04-06 12:44:13 +03:00
|
|
|
int RunVertices(DataReader src, DataReader dst, int count) override;
|
2014-12-13 02:51:14 +02:00
|
|
|
std::string GetName() const override { return "OldLoader"; }
|
|
|
|
bool IsInitialized() override { return true; } // This vertex loader supports all formats
|
2014-08-25 06:53:28 +03:00
|
|
|
|
2014-12-13 11:57:46 +02:00
|
|
|
// They are used for the communication with the loader functions
|
2015-01-19 19:33:08 +02:00
|
|
|
float m_posScale;
|
|
|
|
float m_tcScale[8];
|
2014-12-13 11:57:46 +02:00
|
|
|
int m_tcIndex;
|
|
|
|
int m_colIndex;
|
|
|
|
|
|
|
|
// Matrix components are first in GC format but later in PC format - we need to store it temporarily
|
|
|
|
// when decoding each vertex.
|
|
|
|
u8 m_curtexmtx[8];
|
|
|
|
int m_texmtxwrite;
|
|
|
|
int m_texmtxread;
|
2014-12-21 15:29:44 +02:00
|
|
|
bool m_vertexSkip;
|
|
|
|
int m_skippedVertices;
|
2015-06-01 20:58:27 +03:00
|
|
|
int m_counter;
|
2014-12-13 11:57:46 +02:00
|
|
|
|
2008-12-08 06:46:09 +02:00
|
|
|
private:
|
2014-02-23 16:14:27 +02:00
|
|
|
// Pipeline.
|
2008-12-08 06:46:09 +02:00
|
|
|
TPipelineFunction m_PipelineStages[64]; // TODO - figure out real max. it's lower.
|
|
|
|
int m_numPipelineStages;
|
|
|
|
|
|
|
|
void CompileVertexTranslator();
|
|
|
|
|
|
|
|
void WriteCall(TPipelineFunction);
|
2013-03-20 03:51:12 +02:00
|
|
|
};
|