30 #include "../../../idlib/precompiled.h"
33 #include "../radiant/QE3.H"
42 renderedView.setMedia(
"_default" );
62 void MaterialPreviewView::AssertValid()
const {
66 void MaterialPreviewView::Dump(CDumpContext& dc)
const {
75 if (CView::OnCreate(lpCreateStruct) == -1)
81 dwStyle = WS_CHILD|WS_VISIBLE;
90 renderWindow.SetWindowPos(
NULL, 0, 0, rc.Width(), rc.Height(), SWP_SHOWWINDOW);
99 CView::OnSize( nType, cx, cy );
103 renderWindow.SetWindowPos(
NULL, 0, 0, rc.Width(), rc.Height(), SWP_SHOWWINDOW);
182 extern float fDiff(
float f1,
float f2);
214 spawnArgs.
Set(
"classname",
"func_static");
216 spawnArgs.
Set(
"origin",
"0 0 0");
267 float sensitivity = 0.5f;
272 if (
button == MK_LBUTTON) {
299 }
else if (
button == MK_RBUTTON) {
301 float lightMovement = 0;
302 idVec3 lightForward, lightRight, lightUp;
311 lightMovement = -( y -
pressY ) * sensitivity;
315 lightMove = lightForward * lightMovement;
319 lightMovement = (x -
pressX) * sensitivity;
323 lightMove = lightRight * lightMovement;
326 lightMovement = -(y -
pressY) * sensitivity;
330 lightMove += lightUp * lightMovement;
339 vLight->
origin += lightMove;
344 }
else if (
button == MK_MBUTTON ) {
367 spawnArgs.
Set(
"classname",
"light" );
368 spawnArgs.
Set(
"name",
va(
"light_%d", lightId ) );
369 spawnArgs.
Set(
"origin",
va(
"-128 0 %d", (lightId * 16) ) );
370 spawnArgs.
Set(
"light",
"300" );
371 spawnArgs.
Set(
"texture",
"lights/defaultPointLight" );
373 spawnArgs.
Set(
"_color", str );
495 session->
rw->
DrawText(
va(
"%d", i+1 ), vLight->
renderLight.
origin +
idVec3(0,0,5), 0.25
f,
idVec4(1,1,0,1), refdef->
viewaxis, 1, 0,
true );
517 memset( &refdef, 0,
sizeof( refdef ) );
571 }
else if ( ratio == 1 ) {
573 }
else if ( ratio == 2 ) {
575 }
else if ( ratio == 4 ) {
577 }
else if ( ratio == 0.5 ) {
579 }
else if ( ratio == 0.25 ) {
641 if ( modelName.
Length() ) {
void setLightAllowMove(const int lightId, const bool move)
GLsizei const GLfloat * value
virtual void EndFrame(int *frontEndMsec, int *backEndMsec)=0
renderLight_t renderLight
virtual void FreeLightDef(qhandle_t lightHandle)=0
idMat3 mat3_identity(idVec3(1, 0, 0), idVec3(0, 1, 0), idVec3(0, 0, 1))
const int MAX_GLOBAL_SHADER_PARMS
void setCustomModel(const idStr modelName)
idMaterial * renderMaterial
virtual void buttonDown(int _button, float x, float y)
CONST PIXELFORMATDESCRIPTOR UINT
const int GetNumStages(void) const
virtual qhandle_t AddEntityDef(const renderEntity_t *re)=0
void OnModelChange(int modelId)
void Set(const float x, const float y, const float z)
const idMaterial * shader
void setLightShader(const int lightId, const idStr shaderName)
idRenderSystem * renderSystem
void OnDeleteLight(int lightId)
static float ClampFloat(float min, float max, float value)
void setLocalParm(int parmNum, float value)
const char * GetName(void) const
const int SHADERPARM_GREEN
int GetImageHeight(void) const
idRenderModel * worldModel
virtual qhandle_t AddLightDef(const renderLight_t *rlight)=0
virtual const idMaterial * FindMaterial(const char *name, bool makeDefault=true)=0
void Set(const char *key, const char *value)
virtual void BeginFrame(int windowWidth, int windowHeight)=0
const idMaterial * customShader
void drawLights(renderView_t *refdef)
const int MAX_ENTITY_SHADER_PARMS
float shaderParms[MAX_ENTITY_SHADER_PARMS]
virtual void InitEmpty(const char *name)=0
float fDiff(float f1, float f2)
void deleteLight(const int lightId)
const int SHADERPARM_BLUE
static const float M_RAD2DEG
void OnLightRadiusChange(int lightId, float radius)
bool Sys_KeyDown(int key)
void Set(float pitch, float yaw, float roll)
virtual idRenderWorld * AllocRenderWorld(void)=0
Responsible for managing a single material that is being viewed and/or edited.
idAngles ToAngles(void) const
const char * GetString(const char *key, const char *defaultString="") const
GLubyte GLubyte GLubyte GLubyte w
idVec3 ToForward(void) const
void OnCustomModelChange(idStr modelName)
const shaderStage_t * GetStage(const int index) const
void OnShowLightsChange(bool showLights)
idVec3 vec3_origin(0.0f, 0.0f, 0.0f)
virtual void mouseMove(float x, float y)
void OnLightAllowMoveChange(int lightId, bool move)
virtual idRenderModel * FindModel(const char *modelName)=0
void OnGlobalParmChange(int parmNum, float value)
void UpdateCamera(renderView_t *refdef)
virtual ~MaterialPreviewView()
virtual void DebugClearLines(int time)=0
float shaderParms[MAX_GLOBAL_SHADER_PARMS]
virtual bool InitFromMap(const char *mapName)=0
virtual void UpdateEntityDef(qhandle_t entityHandle, const renderEntity_t *re)=0
idGLDrawableView renderedView
virtual void DrawText(const char *text, const idVec3 &origin, float scale, const idVec4 &color, const idMat3 &viewAxis, const int align=1, const int lifetime=0, bool depthTest=false)=0
virtual void draw(int x, int y, int w, int h)
virtual void DebugSphere(const idVec4 &color, const idSphere &sphere, const int lifetime=0, bool depthTest=false)=0
void setShowLights(bool _showLights)
virtual void UpdateLightDef(qhandle_t lightHandle, const renderLight_t *rlight)=0
const idMaterial * material
void setLightRadius(const int lightId, const float radius)
void setGlobalParm(int parmNum, float value)
idDeclManager * declManager
renderEntity_t worldEntity
afx_msg void OnSize(UINT nType, int cx, int cy)
idRenderModelManager * renderModelManager
IMPLEMENT_DYNCREATE(CCamWnd, CWnd)
idMat3 ToMat3(void) const
idList< lightInfo_t > viewLights
void OnLocalParmChange(int parmNum, float value)
int GetImageWidth(void) const
void OnLightShaderChange(int lightId, idStr shaderName)
void MV_OnMaterialSelectionChange(MaterialDoc *pMaterial)
Called when the selected material has changed.
const char * c_str(void) const
void setLightColor(const int lightId, const idVec3 &value)
virtual void ParseSpawnArgsToRenderLight(const idDict *args, renderLight_t *renderLight)
virtual void RenderScene(const renderView_t *renderView)=0
virtual void ParseSpawnArgsToRenderEntity(const idDict *args, renderEntity_t *renderEntity)
char * va(const char *fmt,...)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct)
const idMaterial * shader
void ToVectors(idVec3 *forward, idVec3 *right=NULL, idVec3 *up=NULL) const
void OnLightColorChange(int lightId, idVec3 &color)
float shaderParms[MAX_ENTITY_SHADER_PARMS]
int sprintf(idStr &string, const char *fmt,...)
virtual void setMedia(const char *name)
virtual idRenderModel * AllocModel()=0
float globalParms[MAX_GLOBAL_SHADER_PARMS]